projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9fbee73
)
move from legacy compat JSON to_json to modern JSON::XS encode_json, RT#22630
author
Ivan Kohler
<ivan@freeside.biz>
Thu, 18 Apr 2013 03:44:39 +0000
(20:44 -0700)
committer
Ivan Kohler
<ivan@freeside.biz>
Thu, 18 Apr 2013 03:44:39 +0000
(20:44 -0700)
FS/FS/Mason.pm
patch
|
blob
|
history
FS/FS/UI/Web.pm
patch
|
blob
|
history
httemplate/edit/payment_gateway.html
patch
|
blob
|
history
httemplate/elements/auto-table.html
patch
|
blob
|
history
httemplate/elements/dashboard-toplist.html
patch
|
blob
|
history
httemplate/elements/select-tiered.html
patch
|
blob
|
history
httemplate/elements/tr-select-cust_location.html
patch
|
blob
|
history
httemplate/misc/xmlhttp-cust_bill_pkg-calculate_taxes.html
patch
|
blob
|
history
httemplate/misc/xmlhttp-cust_main-email_search.html
patch
|
blob
|
history
diff --git
a/FS/FS/Mason.pm
b/FS/FS/Mason.pm
index
d277c28
..
1553a42
100644
(file)
--- a/
FS/FS/Mason.pm
+++ b/
FS/FS/Mason.pm
@@
-77,7
+77,7
@@
if ( -e $addl_handler_use_file ) {
use HTML::TableExtract qw(tree);
use HTML::FormatText;
use HTML::Defang;
use HTML::TableExtract qw(tree);
use HTML::FormatText;
use HTML::Defang;
- use JSON;
+ use JSON
::XS
;
# use XMLRPC::Transport::HTTP;
# use XMLRPC::Lite; # for XMLRPC::Serializer
use MIME::Base64;
# use XMLRPC::Transport::HTTP;
# use XMLRPC::Lite; # for XMLRPC::Serializer
use MIME::Base64;
diff --git
a/FS/FS/UI/Web.pm
b/FS/FS/UI/Web.pm
index
3fd61ef
..
c8ad430
100644
(file)
--- a/
FS/FS/UI/Web.pm
+++ b/
FS/FS/UI/Web.pm
@@
-581,7
+581,7
@@
use vars qw($DEBUG);
use Carp;
use Storable qw(nfreeze);
use MIME::Base64;
use Carp;
use Storable qw(nfreeze);
use MIME::Base64;
-use JSON;
+use JSON
::XS
;
use FS::UID qw(getotaker);
use FS::Record qw(qsearchs);
use FS::queue;
use FS::UID qw(getotaker);
use FS::Record qw(qsearchs);
use FS::queue;
@@
-726,10
+726,7
@@
sub job_status {
@return = ( 'error', $job ? $job->statustext : $jobnum );
}
@return = ( 'error', $job ? $job->statustext : $jobnum );
}
- #to_json(\@return); #waiting on deb 5.0 for new JSON.pm?
- #silence the warning though
- my $to_json = JSON->can('to_json') || JSON->can('objToJson');
- &$to_json(\@return);
+ encode_json \@return;
}
}
diff --git
a/httemplate/edit/payment_gateway.html
b/httemplate/edit/payment_gateway.html
index
dfe52f1
..
a469beb
100644
(file)
--- a/
httemplate/edit/payment_gateway.html
+++ b/
httemplate/edit/payment_gateway.html
@@
-19,7
+19,7
@@
<SCRIPT TYPE="text/javascript">
<SCRIPT TYPE="text/javascript">
- var modulesForNamespace = <%
to
_json(\%modules_for_namespace, {canonical=>1}) %>;
+ var modulesForNamespace = <%
encode
_json(\%modules_for_namespace, {canonical=>1}) %>;
function changeNamespace(what) {
var ns = what.value;
var select_module = document.getElementById('gateway_module');
function changeNamespace(what) {
var ns = what.value;
var select_module = document.getElementById('gateway_module');
diff --git
a/httemplate/elements/auto-table.html
b/httemplate/elements/auto-table.html
index
3a3bd40
..
5118b91
100644
(file)
--- a/
httemplate/elements/auto-table.html
+++ b/
httemplate/elements/auto-table.html
@@
-50,7
+50,7
@@
var <%$pre%>next_rownum;
var <%$pre%>set_rownum;
var <%$pre%>addRow;
var <%$pre%>deleteRow;
var <%$pre%>set_rownum;
var <%$pre%>addRow;
var <%$pre%>deleteRow;
-var <%$pre%>fieldorder = <%
to
_json($fieldorder) %>;
+var <%$pre%>fieldorder = <%
encode
_json($fieldorder) %>;
function <%$pre%>possiblyAddRow_factory(obj) {
var callback = obj.onchange;
function <%$pre%>possiblyAddRow_factory(obj) {
var callback = obj.onchange;
@@
-190,7
+190,7
@@
function <%$pre%>init() {
<%$pre%>template.appendChild(delete_cell);
// preload rows
<%$pre%>template.appendChild(delete_cell);
// preload rows
- var rows = <%
to
_json(\@rows) %>;
+ var rows = <%
encode
_json(\@rows) %>;
for (var i = 0; i < rows.length; i++) {
<%$pre%>addRow(rows[i]);
}
for (var i = 0; i < rows.length; i++) {
<%$pre%>addRow(rows[i]);
}
diff --git
a/httemplate/elements/dashboard-toplist.html
b/httemplate/elements/dashboard-toplist.html
index
f4a3725
..
b80af78
100644
(file)
--- a/
httemplate/elements/dashboard-toplist.html
+++ b/
httemplate/elements/dashboard-toplist.html
@@
-169,7
+169,6
@@
if ( $FS::TicketSystem::system eq 'RT_Internal'
ObjectCustomFieldValues.ObjectId = cust_tickets.Id
)
GROUP BY cust_tickets.custnum, ObjectCustomFieldValues.Content";
ObjectCustomFieldValues.ObjectId = cust_tickets.Id
)
GROUP BY cust_tickets.custnum, ObjectCustomFieldValues.Content";
- #warn $sql."\n";
} else { # no custom_priority_field
$sql =
"SELECT cust_tickets.custnum,
} else { # no custom_priority_field
$sql =
"SELECT cust_tickets.custnum,
@@
-181,10
+180,8
@@
if ( $FS::TicketSystem::system eq 'RT_Internal'
my $sth = dbh->prepare($sql) or die dbh->errstr;
$sth->execute or die $sth->errstr;
while ( my $row = $sth->fetchrow_hashref ) {
my $sth = dbh->prepare($sql) or die dbh->errstr;
$sth->execute or die $sth->errstr;
while ( my $row = $sth->fetchrow_hashref ) {
- #warn to_json($row)."\n";
$num_tickets_by_priority{ $row->{priority} }->{ $row->{custnum} } =
$row->{num_tickets};
}
}
$num_tickets_by_priority{ $row->{priority} }->{ $row->{custnum} } =
$row->{num_tickets};
}
}
-#warn Dumper \%num_tickets_by_priority;
</%init>
</%init>
diff --git
a/httemplate/elements/select-tiered.html
b/httemplate/elements/select-tiered.html
index
e332eef
..
3ff5471
100644
(file)
--- a/
httemplate/elements/select-tiered.html
+++ b/
httemplate/elements/select-tiered.html
@@
-124,13
+124,6
@@
my %opt = @_;
my $pre = $opt{prefix} || '';
my $tiers = $opt{tiers} or die "no tiers defined";
my $pre = $opt{prefix} || '';
my $tiers = $opt{tiers} or die "no tiers defined";
-#my $json = JSON->new()->canonical(); #sort
-# something super weird and broken going on with JSON's auto-loading, just
-# using JSON alone errors out with
-# Can't locate object method "new" via package "null" (perhaps you forgot to
-# load "null"?)
-# yes, "null", not "JSON". so instead, using JSON::XS explicity...
-use JSON::XS;
my $json = JSON::XS->new();
$json->canonical;
my $json = JSON::XS->new();
$json->canonical;
diff --git
a/httemplate/elements/tr-select-cust_location.html
b/httemplate/elements/tr-select-cust_location.html
index
4c17249
..
780bf96
100644
(file)
--- a/
httemplate/elements/tr-select-cust_location.html
+++ b/
httemplate/elements/tr-select-cust_location.html
@@
-153,7
+153,7
@@
Example:
}
}
}
}
- var location_fields = <%
to
_json(\@location_fields) %>;
+ var location_fields = <%
encode
_json(\@location_fields) %>;
function update_location( string ) {
var hash = JSON.parse(string);
for(var i = 0; i < location_fields.length; i++) {
function update_location( string ) {
var hash = JSON.parse(string);
for(var i = 0; i < location_fields.length; i++) {
diff --git
a/httemplate/misc/xmlhttp-cust_bill_pkg-calculate_taxes.html
b/httemplate/misc/xmlhttp-cust_bill_pkg-calculate_taxes.html
index
f618d55
..
c0db3e2
100644
(file)
--- a/
httemplate/misc/xmlhttp-cust_bill_pkg-calculate_taxes.html
+++ b/
httemplate/misc/xmlhttp-cust_bill_pkg-calculate_taxes.html
@@
-1,4
+1,4
@@
-<%
to_json($return) %>
+<%
encode_json($return) %>\
<%init>
my $curuser = $FS::CurrentUser::CurrentUser;
<%init>
my $curuser = $FS::CurrentUser::CurrentUser;
diff --git
a/httemplate/misc/xmlhttp-cust_main-email_search.html
b/httemplate/misc/xmlhttp-cust_main-email_search.html
index
d8c8ef4
..
0d83082
100644
(file)
--- a/
httemplate/misc/xmlhttp-cust_main-email_search.html
+++ b/
httemplate/misc/xmlhttp-cust_main-email_search.html
@@
-1,4
+1,4
@@
-<%
JSON::to
_json(\@result) %>\
+<%
encode
_json(\@result) %>\
<%init>
die 'access denied'
unless $FS::CurrentUser::CurrentUser->access_right('Edit customer');
<%init>
die 'access denied'
unless $FS::CurrentUser::CurrentUser->access_right('Edit customer');