lib/openwfe/expressions/fe_save.rb in openwferu-0.9.15 vs lib/openwfe/expressions/fe_save.rb in openwferu-0.9.16
- old
+ new
@@ -28,12 +28,10 @@
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#++
#
-# $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
-#
#
# "made in Japan"
#
# John Mettraux at openwfe.org
@@ -71,21 +69,24 @@
names :save
def apply (workitem)
- field = lookup_attribute :to_field, workitem
- variable = lookup_attribute :to_variable, workitem
+ field = lookup_string_attribute :to_field, workitem
+ variable = lookup_string_attribute :to_variable, workitem
wi = workitem.dup
if field
- #workitem.attributes[field] = wi.attributes
+
workitem.set_attribute field, wi.attributes
+
elsif variable
+
set_variable variable, wi
end
+
# else, simply don't save
reply_to_parent workitem
end
end
@@ -132,13 +133,13 @@
names :restore
def apply (workitem)
- from_field = lookup_attribute :from_field, workitem
- from_variable = lookup_attribute :from_variable, workitem
- merge_lead = lookup_attribute :merge_lead, workitem
+ from_field = lookup_string_attribute :from_field, workitem
+ from_variable = lookup_string_attribute :from_variable, workitem
+ merge_lead = lookup_sym_attribute :merge_lead, workitem
source = if from_field
att = workitem.lookup_attribute from_field
@@ -184,14 +185,14 @@
OpenWFE::fulldup source.attributes
else
source
end
- to_field = lookup_attribute :to_field, workitem
+ to_field = lookup_string_attribute :to_field, workitem
if to_field
- workitem.set_attribute to_field.strip, attributes
+ workitem.set_attribute to_field, attributes
else
workitem.attributes = attributes
end
workitem
@@ -206,11 +207,9 @@
if source.kind_of?(Hash)
wi = InFlowWorkItem.new
wi.attributes = source
source = wi
end
-
- merge_lead = merge_lead.strip.downcase.intern
wiTarget, wiSource = if merge_lead == :current
[ source, workitem ]
else
[ workitem, source ]