From e9f799b79fca47ee24d2107a0e5c5114dc4e06d8 Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Mon, 2 Feb 2015 18:50:47 -0600 Subject: RT#30248: Unable to remove phone number from contact --- FS/FS/contact.pm | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/FS/FS/contact.pm b/FS/FS/contact.pm index 3205df106..437fd1694 100644 --- a/FS/FS/contact.pm +++ b/FS/FS/contact.pm @@ -268,7 +268,7 @@ sub replace { return $error; } - foreach my $pf ( grep { /^phonetypenum(\d+)$/ && $self->get($_) } + foreach my $pf ( grep { /^phonetypenum(\d+)$/ } keys %{ $self->hashref } ) { $pf =~ /^phonetypenum(\d+)$/ or die "wtf (daily, the)"; my $phonetypenum = $1; @@ -276,8 +276,21 @@ sub replace { my %cp = ( 'contactnum' => $self->contactnum, 'phonetypenum' => $phonetypenum, ); - my $contact_phone = qsearchs('contact_phone', \%cp) - || new FS::contact_phone \%cp; + my $contact_phone = qsearchs('contact_phone', \%cp); + + # if new value is empty, delete old entry + if (!$self->get($pf)) { + if ($contact_phone) { + $error = $contact_phone->delete; + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return $error; + } + } + next; + } + + $contact_phone ||= new FS::contact_phone \%cp; my %cpd = _parse_phonestring( $self->get($pf) ); $contact_phone->set( $_ => $cpd{$_} ) foreach keys %cpd; -- cgit v1.2.1 From 2177596bf13e9de77f09c7380d038200bd675f46 Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Mon, 2 Feb 2015 22:02:53 -0600 Subject: RT#27425: Fixed/blank svc_phone domain --- FS/FS/part_svc.pm | 2 ++ FS/FS/svc_phone.pm | 1 + httemplate/edit/elements/part_svc_column.html | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/FS/FS/part_svc.pm b/FS/FS/part_svc.pm index 2748686cc..f56878acf 100644 --- a/FS/FS/part_svc.pm +++ b/FS/FS/part_svc.pm @@ -697,6 +697,8 @@ some components specified by "select-.*.html", and a bunch more... =item select_label - Used with select_table, this is the field name of labels +=item select_allow_empty - Used with select_table, adds an empty option + =back =cut diff --git a/FS/FS/svc_phone.pm b/FS/FS/svc_phone.pm index 06ce94848..71a61ad16 100644 --- a/FS/FS/svc_phone.pm +++ b/FS/FS/svc_phone.pm @@ -196,6 +196,7 @@ sub table_info { select_table => 'svc_domain', select_key => 'svcnum', select_label => 'domain', + select_allow_empty => 1, disable_inventory => 1, }, 'circuit_svcnum' => { label => 'Circuit', diff --git a/httemplate/edit/elements/part_svc_column.html b/httemplate/edit/elements/part_svc_column.html index 53cda859e..2bb4f5e41 100644 --- a/httemplate/edit/elements/part_svc_column.html +++ b/httemplate/edit/elements/part_svc_column.html @@ -140,7 +140,8 @@ that field. 'value_col' => $def->{'select_key'}, 'order_by' => dbdef->table($def->{'select_table'})->primary_key, 'multiple' => $def->{'multiple'}, - 'disable_empty' => 1, + 'disable_empty' => $def->{'select_allow_empty'} ? undef : 1, + 'empty_label' => $def->{'select_allow_empty'} ? ' ' : undef, 'curr_value' => $value, # these can be switched between multiple and singular, # so put the complete curr_value in an attribute -- cgit v1.2.1 From d9edf24e9d3e1fd87a23359a7679ef6d6637c00d Mon Sep 17 00:00:00 2001 From: Alex Brelsfoard Date: Tue, 3 Feb 2015 07:03:07 -0500 Subject: RT #31482 making sure the tax class is not editable after the customer has been billed. --- httemplate/edit/quick-charge.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/httemplate/edit/quick-charge.html b/httemplate/edit/quick-charge.html index 83620a973..58c1b0a82 100644 --- a/httemplate/edit/quick-charge.html +++ b/httemplate/edit/quick-charge.html @@ -171,6 +171,7 @@ function bill_now_changed (what) { &> % } +% unless ($billed) { <% mt('Tax exempt') |h %> param('setuptax') ? 'CHECKED' : '' %>> @@ -179,6 +180,7 @@ function bill_now_changed (what) { <& /elements/tr-select-taxclass.html, 'curr_value' => $part_pkg->get('taxclass') &> <& /elements/tr-select-taxproduct.html, 'label' => emt('Tax product'), 'onclick' => 'parent.taxproductmagic(this);', 'curr_value' => $part_pkg->get('taxproductnum') &> +% } % } else { # new one-time charge -- cgit v1.2.1