projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
2a49a71
)
preserve quantity when changing package type/location, #24259
author
Mark Wells
<mark@freeside.biz>
Fri, 9 Aug 2013 20:36:43 +0000
(13:36 -0700)
committer
Mark Wells
<mark@freeside.biz>
Fri, 9 Aug 2013 20:36:43 +0000
(13:36 -0700)
FS/FS/cust_pkg.pm
patch
|
blob
|
history
httemplate/edit/process/change-cust_pkg.html
patch
|
blob
|
history
httemplate/elements/tr-input-pkg-quantity.html
[new file with mode: 0644]
patch
|
blob
httemplate/misc/change_pkg.cgi
patch
|
blob
|
history
httemplate/misc/order_pkg.html
patch
|
blob
|
history
httemplate/view/cust_main/packages/location.html
patch
|
blob
|
history
httemplate/view/cust_main/packages/package.html
patch
|
blob
|
history
httemplate/view/cust_main/packages/status.html
patch
|
blob
|
history
diff --git
a/FS/FS/cust_pkg.pm
b/FS/FS/cust_pkg.pm
index
01eaf62
..
0ecc0ff
100644
(file)
--- a/
FS/FS/cust_pkg.pm
+++ b/
FS/FS/cust_pkg.pm
@@
-1734,6
+1734,11
@@
New pkgpart (see L<FS::part_pkg>).
New refnum (see L<FS::part_referral>).
New refnum (see L<FS::part_referral>).
+=item quantity
+
+New quantity; if unspecified, the new package will have the same quantity
+as the old.
+
=item cust_pkg
"New" (existing) FS::cust_pkg object. The package's services and other
=item cust_pkg
"New" (existing) FS::cust_pkg object. The package's services and other
@@
-1769,9
+1774,6
@@
sub change {
my $self = shift;
my $opt = ref($_[0]) ? shift : { @_ };
my $self = shift;
my $opt = ref($_[0]) ? shift : { @_ };
-# my ($custnum, $pkgparts, $remove_pkgnum, $return_cust_pkg, $refnum) = @_;
-#
-
my $conf = new FS::Conf;
# Transactionize this whole mess
my $conf = new FS::Conf;
# Transactionize this whole mess
@@
-1792,10
+1794,6
@@
sub change {
my $time = time;
my $time = time;
- #$hash{$_} = $self->$_() foreach qw( last_bill bill );
-
- #$hash{$_} = $self->$_() foreach qw( setup );
-
$hash{'setup'} = $time if $self->setup;
$hash{'change_date'} = $time;
$hash{'setup'} = $time if $self->setup;
$hash{'change_date'} = $time;
@@
-1867,6
+1865,7
@@
sub change {
}
$hash{'contactnum'} = $opt->{'contactnum'} if $opt->{'contactnum'};
}
$hash{'contactnum'} = $opt->{'contactnum'} if $opt->{'contactnum'};
+ $hash{'quantity'} = $opt->{'quantity'} || $self->quantity;
my $cust_pkg;
if ( $opt->{'cust_pkg'} ) {
my $cust_pkg;
if ( $opt->{'cust_pkg'} ) {
@@
-2100,7
+2099,9
@@
The date for the package change. Required, and must be in the future.
=item locationnum
=item locationnum
-The pkgpart and locationnum of the new package, with the same
+=item quantity
+
+The pkgpart. locationnum, and quantity of the new package, with the same
meaning as in C<change>.
=back
meaning as in C<change>.
=back
@@
-2132,7
+2133,9
@@
sub change_later {
if $opt->{'pkgpart'} and $opt->{'pkgpart'} != $change_to->pkgpart;
my $new_locationnum = $opt->{'locationnum'}
if $opt->{'locationnum'} and $opt->{'locationnum'} != $change_to->locationnum;
if $opt->{'pkgpart'} and $opt->{'pkgpart'} != $change_to->pkgpart;
my $new_locationnum = $opt->{'locationnum'}
if $opt->{'locationnum'} and $opt->{'locationnum'} != $change_to->locationnum;
- if ( $new_pkgpart or $new_locationnum ) {
+ my $new_quantity = $opt->{'quantity'}
+ if $opt->{'quantity'} and $opt->{'quantity'} != $change_to->quantity;
+ if ( $new_pkgpart or $new_locationnum or $new_quantity ) {
# it hasn't been billed yet, so in principle we could just edit
# it in place (w/o a package change), but that's bad form.
# So change the package according to the new options...
# it hasn't been billed yet, so in principle we could just edit
# it in place (w/o a package change), but that's bad form.
# So change the package according to the new options...
@@
-2170,12
+2173,16
@@
sub change_later {
if $opt->{'pkgpart'} and $opt->{'pkgpart'} != $self->pkgpart;
my $new_locationnum = $opt->{'locationnum'}
if $opt->{'locationnum'} and $opt->{'locationnum'} != $self->locationnum;
if $opt->{'pkgpart'} and $opt->{'pkgpart'} != $self->pkgpart;
my $new_locationnum = $opt->{'locationnum'}
if $opt->{'locationnum'} and $opt->{'locationnum'} != $self->locationnum;
- return '' unless $new_pkgpart or $new_locationnum; # wouldn't do anything
+ my $new_quantity = $opt->{'quantity'}
+ if $opt->{'quantity'} and $opt->{'quantity'} != $self->quantity;
+
+ return '' unless $new_pkgpart or $new_locationnum or $new_quantity; # wouldn't do anything
my %hash = (
'custnum' => $self->custnum,
'pkgpart' => ($opt->{'pkgpart'} || $self->pkgpart),
'locationnum' => ($opt->{'locationnum'} || $self->locationnum),
my %hash = (
'custnum' => $self->custnum,
'pkgpart' => ($opt->{'pkgpart'} || $self->pkgpart),
'locationnum' => ($opt->{'locationnum'} || $self->locationnum),
+ 'quantity' => ($opt->{'quantity'} || $self->quantity),
'start_date' => $date,
);
my $new = FS::cust_pkg->new(\%hash);
'start_date' => $date,
);
my $new = FS::cust_pkg->new(\%hash);
diff --git
a/httemplate/edit/process/change-cust_pkg.html
b/httemplate/edit/process/change-cust_pkg.html
index
9d06d8e
..
0d571de
100644
(file)
--- a/
httemplate/edit/process/change-cust_pkg.html
+++ b/
httemplate/edit/process/change-cust_pkg.html
@@
-27,7
+27,7
@@
my $cust_pkg = qsearchs({
die 'unknown pkgnum' unless $cust_pkg;
my %change = map { $_ => scalar($cgi->param($_)) }
die 'unknown pkgnum' unless $cust_pkg;
my %change = map { $_ => scalar($cgi->param($_)) }
- qw( locationnum pkgpart );
+ qw( locationnum pkgpart
quantity
);
$change{'keep_dates'} = 1;
$change{'keep_dates'} = 1;
diff --git a/httemplate/elements/tr-input-pkg-quantity.html
b/httemplate/elements/tr-input-pkg-quantity.html
new file mode 100644
(file)
index 0000000..
7ade573
--- /dev/null
+++ b/
httemplate/elements/tr-input-pkg-quantity.html
@@ -0,0
+1,15
@@
+% if ( FS::Conf->new->exists('invoice-unitprice') or $curr_value > 1 ) {
+ <TR>
+ <TH ALIGN="right"><% mt('Quantity') |h %>
+ </TH>
+ <TD>
+ <INPUT TYPE="text" NAME="quantity" SIZE=4 VALUE="<% $curr_value |h %>">
+ </TD>
+ </TR>
+% } else {
+ <INPUT TYPE="hidden" NAME="quantity" VALUE="1">
+% }
+<%init>
+my %opt = @_;
+my $curr_value = $cgi->param('quantity') || $opt{'curr_value'} || 1;
+</%init>
diff --git
a/httemplate/misc/change_pkg.cgi
b/httemplate/misc/change_pkg.cgi
index
7425fbf
..
923be71
100755
(executable)
--- a/
httemplate/misc/change_pkg.cgi
+++ b/
httemplate/misc/change_pkg.cgi
@@
-22,6
+22,10
@@
'cust_main' => $cust_main,
&>
'cust_main' => $cust_main,
&>
+ <& /elements/tr-input-pkg-quantity.html,
+ 'curr_value' => $cust_pkg->quantity
+ &>
+
<& /elements/tr-select-cust_location.html,
'cgi' => $cgi,
'cust_main' => $cust_main,
<& /elements/tr-select-cust_location.html,
'cgi' => $cgi,
'cust_main' => $cust_main,
@@
-94,7
+98,7
@@
my $title = "Change Package";
if ( $cust_pkg->change_to_pkgnum ) {
my $change_to = FS::cust_pkg->by_key($cust_pkg->change_to_pkgnum);
$cgi->param('delay', 1);
if ( $cust_pkg->change_to_pkgnum ) {
my $change_to = FS::cust_pkg->by_key($cust_pkg->change_to_pkgnum);
$cgi->param('delay', 1);
- foreach(qw( start_date pkgpart locationnum )) {
+ foreach(qw( start_date pkgpart locationnum
quantity
)) {
$cgi->param($_, $change_to->get($_));
}
$title = "Edit Scheduled Package Change";
$cgi->param($_, $change_to->get($_));
}
$title = "Edit Scheduled Package Change";
diff --git
a/httemplate/misc/order_pkg.html
b/httemplate/misc/order_pkg.html
index
a257e53
..
66c405a
100644
(file)
--- a/
httemplate/misc/order_pkg.html
+++ b/
httemplate/misc/order_pkg.html
@@
-37,16
+37,7
@@
&>
% }
&>
% }
-% if ( $conf->exists('invoice-unitprice') ) {
- <TR>
- <TH ALIGN="right"><% mt('Quantity') |h %> </TD>
- <TD>
- <INPUT TYPE="text" NAME="quantity" SIZE=4 VALUE="<% $quantity %>">
- </TD>
- </TR>
-% } else {
- <INPUT TYPE="hidden" NAME="quantity" VALUE="1">
-% }
+<& /elements/tr-input-pkg-quantity.html, curr_value => $quantity &>
<TR>
<TH ALIGN="right"><% mt('Start date') |h %> </TD>
<TR>
<TH ALIGN="right"><% mt('Start date') |h %> </TD>
diff --git
a/httemplate/view/cust_main/packages/location.html
b/httemplate/view/cust_main/packages/location.html
index
01cbc0f
..
5ff2b1e
100644
(file)
--- a/
httemplate/view/cust_main/packages/location.html
+++ b/
httemplate/view/cust_main/packages/location.html
@@
-70,8
+70,8
@@
sub pkg_change_location_link {
'label' => emt('Change location'),
'actionlabel' => emt('Change'),
'cust_pkg' => $cust_pkg,
'label' => emt('Change location'),
'actionlabel' => emt('Change'),
'cust_pkg' => $cust_pkg,
- 'width' =>
763
,
- 'height' =>
38
0,
+ 'width' =>
960
,
+ 'height' =>
49
0,
);
}
);
}
diff --git
a/httemplate/view/cust_main/packages/package.html
b/httemplate/view/cust_main/packages/package.html
index
596a473
..
7df0869
100644
(file)
--- a/
httemplate/view/cust_main/packages/package.html
+++ b/
httemplate/view/cust_main/packages/package.html
@@
-280,8
+280,8
@@
sub pkg_change_link {
'label' => emt('Change package'),
'actionlabel' => emt('Change'),
'cust_pkg' => $cust_pkg,
'label' => emt('Change package'),
'actionlabel' => emt('Change'),
'cust_pkg' => $cust_pkg,
- 'width' =>
763
,
- 'height' => 4
8
0,
+ 'width' =>
960
,
+ 'height' => 4
9
0,
);
}
);
}
@@
-295,8
+295,8
@@
sub pkg_change_location_link {
'label' => emt('Change location'),
'actionlabel' => emt('Change'),
'cust_pkg' => $cust_pkg,
'label' => emt('Change location'),
'actionlabel' => emt('Change'),
'cust_pkg' => $cust_pkg,
- 'width' =>
763
,
- 'height' =>
38
0,
+ 'width' =>
960
,
+ 'height' =>
49
0,
);
}
);
}
diff --git
a/httemplate/view/cust_main/packages/status.html
b/httemplate/view/cust_main/packages/status.html
index
6894a4e
..
70b623c
100644
(file)
--- a/
httemplate/view/cust_main/packages/status.html
+++ b/
httemplate/view/cust_main/packages/status.html
@@
-645,8
+645,8
@@
sub pkg_change_later_link {
'label' => emt('Reschedule'),
'actionlabel' => emt('Edit scheduled change for'),
'cust_pkg' => $cust_pkg,
'label' => emt('Reschedule'),
'actionlabel' => emt('Edit scheduled change for'),
'cust_pkg' => $cust_pkg,
- 'width' =>
763
,
- 'height' => 4
8
0,
+ 'width' =>
960
,
+ 'height' => 4
9
0,
)
}
)
}