Fix handling of extra_query_params in Business::OnlinePayment wrapper.
[interchange.git] / code / UserTag / values_space.tag
1 # Copyright 2004-2007 Interchange Development Group and others
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.  See the LICENSE file for details.
7
8 # $Id: values_space.tag,v 1.5 2007-03-30 23:40:57 pajamian Exp $
9
10 UserTag values-space Order   name
11 UserTag values-space addAttr
12 UserTag values-space Version $Revision: 1.5 $
13 UserTag values-space Routine <<EOR
14 sub {
15         my ($name, $opt) = @_;
16         return $Vend::ValuesSpace unless defined $name;
17
18         my $old_name = $Vend::ValuesSpace;
19         my $old_ref;
20         if ($old_name eq '') {
21                 $old_ref = $Vend::Session->{values};
22         }
23         else {
24                 $old_ref = $Vend::Session->{values_repository}{$old_name} ||= {};
25         }
26
27         if ($name eq '') {
28                 $::Values = $Vend::Session->{values};
29         }
30         else {
31                 $::Values = $Vend::Session->{values_repository}{$name} ||= {};
32         }
33         $Vend::ValuesSpace = $name;
34
35         %$::Values = () if $opt->{clear};
36
37         my @copy;
38         if ($opt->{copy_all}) {
39                 @copy = keys %$old_ref;
40         }
41         elsif ($opt->{copy}) {
42                 @copy = grep /\S/, split / /, $opt->{copy};
43         }
44         $::Values->{$_} = $old_ref->{$_} for @copy;
45
46 #Debug("changed values space from $old_name to $name; new contents:\n" . ::uneval($::Values));
47         return $opt->{show} ? $old_name : '';
48 }
49 EOR