projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7a7776b
)
RT#34960: Quotations [changed billpkgnum to quotationpkgnum]
author
Jonathan Prykop
<jonathan@freeside.biz>
Mon, 9 Nov 2015 23:05:36 +0000
(17:05 -0600)
committer
Jonathan Prykop
<jonathan@freeside.biz>
Wed, 11 Nov 2015 00:41:26 +0000
(18:41 -0600)
FS/FS/Schema.pm
patch
|
blob
|
history
FS/FS/TemplateItem_Mixin.pm
patch
|
blob
|
history
FS/FS/quotation_pkg.pm
patch
|
blob
|
history
FS/FS/quotation_pkg_detail.pm
patch
|
blob
|
history
httemplate/edit/quotation_pkg_detail.html
patch
|
blob
|
history
diff --git
a/FS/FS/Schema.pm
b/FS/FS/Schema.pm
index
429bc55
..
8600217
100644
(file)
--- a/
FS/FS/Schema.pm
+++ b/
FS/FS/Schema.pm
@@
-1386,7
+1386,7
@@
sub tables_hashref {
'quotation_pkg_detail' => {
'columns' => [
'detailnum', 'serial', '', '', '', '',
'quotation_pkg_detail' => {
'columns' => [
'detailnum', 'serial', '', '', '', '',
- '
billpkgnum', 'int', '', '', '', '', # actually links to quotationpkgnum
+ '
quotationpkgnum', 'int', '', '', '', '',
'format', 'char', 'NULL', 1, '', '', # not used for anything
'detail', 'varchar', '', 255, '', '',
],
'format', 'char', 'NULL', 1, '', '', # not used for anything
'detail', 'varchar', '', 255, '', '',
],
@@
-1394,7
+1394,7
@@
sub tables_hashref {
'unique' => [],
'index' => [ [ 'billpkgnum' ] ],
'foreign_keys' => [
'unique' => [],
'index' => [ [ 'billpkgnum' ] ],
'foreign_keys' => [
- { columns => [ '
bill
pkgnum' ],
+ { columns => [ '
quotation
pkgnum' ],
table => 'quotation_pkg',
references => [ 'quotationpkgnum' ],
},
table => 'quotation_pkg',
references => [ 'quotationpkgnum' ],
},
diff --git
a/FS/FS/TemplateItem_Mixin.pm
b/FS/FS/TemplateItem_Mixin.pm
index
dcd7ab3
..
248da3c
100644
(file)
--- a/
FS/FS/TemplateItem_Mixin.pm
+++ b/
FS/FS/TemplateItem_Mixin.pm
@@
-175,6
+175,7
@@
sub details {
my $escape_function = $opt{escape_function} || sub { shift };
my $csv = new Text::CSV_XS;
my $escape_function = $opt{escape_function} || sub { shift };
my $csv = new Text::CSV_XS;
+ my $key = $self->primary_key;
if ( $opt{format_function} ) {
if ( $opt{format_function} ) {
@@
-189,14
+190,14
@@
sub details {
)
}
qsearch ({ 'table' => $self->detail_table,
)
}
qsearch ({ 'table' => $self->detail_table,
- 'hashref' => {
'billpkgnum' => $self->billpkgnum
},
+ 'hashref' => {
$key => $self->get($key)
},
'order_by' => 'ORDER BY detailnum',
});
} elsif ( $opt{'no_usage'} ) {
my $sql = "SELECT detail FROM ". $self->detail_table.
'order_by' => 'ORDER BY detailnum',
});
} elsif ( $opt{'no_usage'} ) {
my $sql = "SELECT detail FROM ". $self->detail_table.
- " WHERE
billpkgnum = ". $self->billpkgnum
.
+ " WHERE
" . $key . " = ". $self->get($key)
.
" AND ( format IS NULL OR format != 'C' ) ".
" ORDER BY detailnum";
my $sth = dbh->prepare($sql) or die dbh->errstr;
" AND ( format IS NULL OR format != 'C' ) ".
" ORDER BY detailnum";
my $sth = dbh->prepare($sql) or die dbh->errstr;
@@
-251,7
+252,7
@@
sub details {
}
my $sql = "SELECT format, detail FROM ". $self->detail_table.
}
my $sql = "SELECT format, detail FROM ". $self->detail_table.
- " WHERE
billpkgnum = ". $self->billpkgnum
.
+ " WHERE
" . $key . " = ". $self->get($key)
.
" ORDER BY detailnum";
my $sth = dbh->prepare($sql) or die dbh->errstr;
$sth->execute or die $sth->errstr;
" ORDER BY detailnum";
my $sth = dbh->prepare($sql) or die dbh->errstr;
$sth->execute or die $sth->errstr;
diff --git
a/FS/FS/quotation_pkg.pm
b/FS/FS/quotation_pkg.pm
index
65e6b62
..
1a2fadc
100644
(file)
--- a/
FS/FS/quotation_pkg.pm
+++ b/
FS/FS/quotation_pkg.pm
@@
-98,21
+98,8
@@
sub display_table { 'quotation_pkg'; }
# # (for invoice display order)
sub discount_table { 'quotation_pkg_discount'; }
# # (for invoice display order)
sub discount_table { 'quotation_pkg_discount'; }
-
-# detail table uses non-quotation fieldnames, see billpkgnum below
sub detail_table { 'quotation_pkg_detail'; }
sub detail_table { 'quotation_pkg_detail'; }
-=item billpkgnum
-
-Sets/returns quotationpkgnum, for ease of integration with TemplateItem_Mixin::details
-
-=cut
-
-sub billpkgnum {
- my $self = shift;
- $self->quotationpkgnum(@_);
-}
-
=item insert
Adds this record to the database. If there is an error, returns the error,
=item insert
Adds this record to the database. If there is an error, returns the error,
@@
-416,7
+403,7
@@
sub delete_details {
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
- foreach my $detail ( qsearch('quotation_pkg_detail',{ '
bill
pkgnum' => $self->quotationpkgnum }) ) {
+ foreach my $detail ( qsearch('quotation_pkg_detail',{ '
quotation
pkgnum' => $self->quotationpkgnum }) ) {
my $error = $detail->delete;
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
my $error = $detail->delete;
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
@@
-452,8
+439,8
@@
sub set_details {
foreach my $detail ( @details ) {
my $quotation_pkg_detail = new FS::quotation_pkg_detail {
foreach my $detail ( @details ) {
my $quotation_pkg_detail = new FS::quotation_pkg_detail {
- '
bill
pkgnum' => $self->quotationpkgnum,
- 'detail'
=> $detail,
+ '
quotation
pkgnum' => $self->quotationpkgnum,
+ 'detail' => $detail,
};
$error = $quotation_pkg_detail->insert;
if ( $error ) {
};
$error = $quotation_pkg_detail->insert;
if ( $error ) {
@@
-467,6
+454,10
@@
sub set_details {
}
}
+sub details_header {
+ return ();
+}
+
=item cust_bill_pkg_display [ type => TYPE ]
=cut
=item cust_bill_pkg_display [ type => TYPE ]
=cut
diff --git
a/FS/FS/quotation_pkg_detail.pm
b/FS/FS/quotation_pkg_detail.pm
index
be3d815
..
ce13589
100644
(file)
--- a/
FS/FS/quotation_pkg_detail.pm
+++ b/
FS/FS/quotation_pkg_detail.pm
@@
-34,10
+34,9
@@
currently supported:
primary key
primary key
-=item
bill
pkgnum
+=item
quotation
pkgnum
-named thusly for quick compatability with L<FS::TemplateItem_Mixin>,
-actually the quotationpkgnum for the relevant L<FS::quotation_pkg>
+for the relevant L<FS::quotation_pkg>
=item detail
=item detail
@@
-108,7
+107,7
@@
sub check {
my $error =
$self->ut_numbern('detailnum')
my $error =
$self->ut_numbern('detailnum')
- || $self->ut_foreign_key('
bill
pkgnum', 'quotation_pkg', 'quotationpkgnum')
+ || $self->ut_foreign_key('
quotation
pkgnum', 'quotation_pkg', 'quotationpkgnum')
|| $self->ut_text('detail')
;
return $error if $error;
|| $self->ut_text('detail')
;
return $error if $error;
diff --git
a/httemplate/edit/quotation_pkg_detail.html
b/httemplate/edit/quotation_pkg_detail.html
index
b8f589a
..
80a9044
100644
(file)
--- a/
httemplate/edit/quotation_pkg_detail.html
+++ b/
httemplate/edit/quotation_pkg_detail.html
@@
-21,15
+21,11
@@
<TD BGCOLOR="#ffffff"><% $part_pkg->comment |h %></TD>
</TR>
<TD BGCOLOR="#ffffff"><% $part_pkg->comment |h %></TD>
</TR>
- <TR>
- <TD COLSPAN=2>Detail: </TD>
- </TR>
-
% my $row = 0;
% for ( @details ) {
<TR>
% my $row = 0;
% for ( @details ) {
<TR>
- <TD></TD>
+ <TD
ALIGN="right"><% $row ? '' : 'Detail' %
></TD>
<TD>
<INPUT TYPE="text" NAME="detail<% $row %>" SIZE="60" MAXLENGTH="65" VALUE="<% $_ |h %>" rownum="<% $row++ %>" onkeyup="possiblyAddRow" onchange="possiblyAddrow">
</TD>
<TD>
<INPUT TYPE="text" NAME="detail<% $row %>" SIZE="60" MAXLENGTH="65" VALUE="<% $_ |h %>" rownum="<% $row++ %>" onkeyup="possiblyAddRow" onchange="possiblyAddrow">
</TD>
@@
-63,6
+59,10
@@
var row = document.createElement('TR');
var empty_cell = document.createElement('TD');
var row = document.createElement('TR');
var empty_cell = document.createElement('TD');
+ if (!rownum) {
+ empty_cell.innerHTML = 'Detail:'
+ empty_cell.style.textAlign = 'right';
+ }
row.appendChild(empty_cell);
var detail_cell = document.createElement('TD');
row.appendChild(empty_cell);
var detail_cell = document.createElement('TD');