[freeside-commits] branch master updated. b3ce58129da19d2fb8d32e9bcdfece2bd3da22bc
Ivan
ivan at 420.am
Tue May 16 15:40:49 PDT 2017
The branch, master has been updated
via b3ce58129da19d2fb8d32e9bcdfece2bd3da22bc (commit)
from 1b3abef9815111c52b1370ba5168a592ae9cfcb0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit b3ce58129da19d2fb8d32e9bcdfece2bd3da22bc
Author: Ivan Kohler <ivan at freeside.biz>
Date: Tue May 16 15:40:47 2017 -0700
prospect add/edit: order fields more like customer add/edit, hide company in residential mode, only have a single contact in residential mode, RT#75990
diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html
index 377a56c..2556874 100644
--- a/httemplate/edit/elements/edit.html
+++ b/httemplate/edit/elements/edit.html
@@ -640,6 +640,15 @@ Example:
return;
}
+% if ( exists( $f->{'js_spawn_test'} ) ) {
+ // XXX check a passed-in hook here and optionall return
+ if ( <% $f->{'js_spawn_test'} %> ) {
+ // then go ahead and spawn
+ } else {
+ return;
+ }
+% }
+
// change the label on the last entry & add a remove button
var prev_label = document.getElementById('<% $field %>_label' + <%$field%>_fieldnum );
prev_label.innerHTML = '<INPUT TYPE="button" VALUE="X" TITLE="Remove this <% lc($f->{'m2_label'}) %>" onClick="remove_<% $field %>(' + <%$field%>_fieldnum + ');" STYLE="color:#ff0000;font-weight:bold;padding-left:2px;padding-right:2px" > <% $f->{'m2_label'} || $field %>';
diff --git a/httemplate/edit/prospect_main.html b/httemplate/edit/prospect_main.html
index 1e05578..6adb471 100644
--- a/httemplate/edit/prospect_main.html
+++ b/httemplate/edit/prospect_main.html
@@ -11,6 +11,11 @@
'taxstatusnum'=> 'Tax status',
},
'fields' => [
+ { 'field' => 'residential_commercial',
+ 'type' => 'radio',
+ 'options' => [ 'Residential', 'Commercial', ],
+ 'onchange' => 'rescom_changed',
+ },
{ 'field' => 'agentnum',
'type' => 'select-agent',
'empty_label' => 'Select agent',
@@ -21,25 +26,21 @@
'empty_label' => 'Select advertising source',
'colspan' => 7,
},
- { 'field' => 'residential_commercial',
- 'type' => 'radio',
- 'options' => [ 'Residential', 'Commercial', ],
- 'onchange' => 'rescom_changed',
- },
{ 'field' => 'company',
'type' => 'text',
'size' => 50,
'colspan' => 7,
},
- { 'field' => 'contactnum',
- 'type' => 'contact',
- 'colspan' => 7,
- 'prospectnum' => $prospectnum,
- 'm2m_method' => 'prospect_contact',
- 'm2m_dstcol' => 'contactnum',
- 'm2_label' => 'Contact',
- 'm2_error_callback' => $m2_error_callback,
+ { 'field' => 'contactnum',
+ 'type' => 'contact',
+ 'colspan' => 7,
+ 'prospectnum' => $prospectnum,
+ 'm2m_method' => 'prospect_contact',
+ 'm2m_dstcol' => 'contactnum',
+ 'm2_label' => 'Contact',
+ 'm2_error_callback' => $m2_error_callback,
'include_opt_callback' => sub { 'for_prospect' => 1 },
+ 'js_spawn_test' => 'document.edit_topform.residential_commercial_Commercial.checked',
},
{ 'field' => 'locationnum',
'type' => 'select-cust_location',
@@ -202,20 +203,20 @@ my $m2_error_callback = sub {
#my @agentnums = $FS::CurrentUser::CurrentUser->agentnums;
-my $javascript = <<END;
+my $javascript = q|
<SCRIPT TYPE="text/javascript">
function rescom_changed() {
+
var f = document.edit_topform;
- var c = f.company;
if ( f.residential_commercial_Residential.checked ) {
- c.disabled = true;
- c.style.backgroundColor = '#dddddd';
+ $('#company_label').slideUp();
+ $('#company_input0').slideUp();
} else if ( f.residential_commercial_Commercial.checked ) {
- c.disabled = false;
- c.style.backgroundColor = '#ffffff';
+ $('#company_label').slideDown();
+ $('#company_input0').slideDown();
}
}
</SCRIPT>
-END
+|;
</%init>
-----------------------------------------------------------------------
Summary of changes:
httemplate/edit/elements/edit.html | 9 ++++++++
httemplate/edit/prospect_main.html | 41 ++++++++++++++++++------------------
2 files changed, 30 insertions(+), 20 deletions(-)
More information about the freeside-commits
mailing list