From 63668be0d05a098de0cf1c8434057b98a1a66c91 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 31 Jan 2008 05:34:12 +0000 Subject: [PATCH] Alter Workflow::Instance and Cron to return empty hashrefs instead of undef. Fix JSON handling in Commerce::Transaction->shippingOptions. This probably isn't a problem now since it is never called as an accessor. --- lib/WebGUI/Commerce/Transaction.pm | 1 + lib/WebGUI/Workflow/Cron.pm | 2 +- lib/WebGUI/Workflow/Instance.pm | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/WebGUI/Commerce/Transaction.pm b/lib/WebGUI/Commerce/Transaction.pm index 9041cd727..197ea4699 100644 --- a/lib/WebGUI/Commerce/Transaction.pm +++ b/lib/WebGUI/Commerce/Transaction.pm @@ -619,6 +619,7 @@ sub shippingOptions { $self->session->db->write("update transaction set shippingOptions=? where transactionId=?",[$self->{_properties}{shippingOptions},$self->{_transactionId}]); } + return {} unless defined $self->{_properties}{shippingOptions}; return from_json($self->{_properties}{shippingOptions}); } diff --git a/lib/WebGUI/Workflow/Cron.pm b/lib/WebGUI/Workflow/Cron.pm index 0bf196817..adb143b5e 100644 --- a/lib/WebGUI/Workflow/Cron.pm +++ b/lib/WebGUI/Workflow/Cron.pm @@ -121,7 +121,7 @@ sub get { return $parameters->{parameters}; } else { - return undef; + return {}; } } return $self->{_data}{$name}; diff --git a/lib/WebGUI/Workflow/Instance.pm b/lib/WebGUI/Workflow/Instance.pm index f114a6b5d..9c5369081 100644 --- a/lib/WebGUI/Workflow/Instance.pm +++ b/lib/WebGUI/Workflow/Instance.pm @@ -152,7 +152,7 @@ sub get { return $parameters->{parameters}; } else { - return undef; + return {}; } } return $self->{_data}{$name};