projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
42ad860
)
mysql compat: cgp_rule_condition s/condition/conditionname/
author
ivan
<ivan>
Mon, 7 Jun 2010 00:10:27 +0000
(
00:10
+0000)
committer
ivan
<ivan>
Mon, 7 Jun 2010 00:10:27 +0000
(
00:10
+0000)
FS/FS/Schema.pm
patch
|
blob
|
history
FS/FS/cgp_rule_condition.pm
patch
|
blob
|
history
FS/bin/freeside-upgrade
patch
|
blob
|
history
httemplate/browse/cgp_rule.html
patch
|
blob
|
history
httemplate/edit/cgp_rule.html
patch
|
blob
|
history
httemplate/edit/process/cgp_rule.html
patch
|
blob
|
history
httemplate/elements/select-cgp_rule_condition.html
patch
|
blob
|
history
diff --git
a/FS/FS/Schema.pm
b/FS/FS/Schema.pm
index
0b54282
..
859224f
100644
(file)
--- a/
FS/FS/Schema.pm
+++ b/
FS/FS/Schema.pm
@@
-1803,7
+1803,7
@@
sub tables_hashref {
'cgp_rule_condition' => {
'columns' => [
'ruleconditionnum', 'serial', '', '', '', '',
'cgp_rule_condition' => {
'columns' => [
'ruleconditionnum', 'serial', '', '', '', '',
- 'condition
',
'varchar', '', $char_d, '', '',
+ 'condition
name',
'varchar', '', $char_d, '', '',
'op', 'varchar', 'NULL', $char_d, '', '',
'params', 'varchar', 'NULL', 255, '', '',
'rulenum', 'int', '', '', '', '',
'op', 'varchar', 'NULL', $char_d, '', '',
'params', 'varchar', 'NULL', 255, '', '',
'rulenum', 'int', '', '', '', '',
diff --git
a/FS/FS/cgp_rule_condition.pm
b/FS/FS/cgp_rule_condition.pm
index
02ea172
..
772e189
100644
(file)
--- a/
FS/FS/cgp_rule_condition.pm
+++ b/
FS/FS/cgp_rule_condition.pm
@@
-36,7
+36,7
@@
currently supported:
primary key
primary key
-=item condition
+=item condition
name
condition
condition
@@
-113,7
+113,7
@@
sub check {
my $error =
$self->ut_numbern('ruleconditionnum')
my $error =
$self->ut_numbern('ruleconditionnum')
- || $self->ut_text('condition')
+ || $self->ut_text('condition
name
')
|| $self->ut_textn('op')
|| $self->ut_textn('params')
|| $self->ut_foreign_key('rulenum', 'cgp_rule', 'rulenum')
|| $self->ut_textn('op')
|| $self->ut_textn('params')
|| $self->ut_foreign_key('rulenum', 'cgp_rule', 'rulenum')
@@
-125,13
+125,13
@@
sub check {
=item arrayref
=item arrayref
-Returns an array reference of the condition, op and params fields.
+Returns an array reference of the condition
name
, op and params fields.
=cut
sub arrayref {
my $self = shift;
=cut
sub arrayref {
my $self = shift;
- [ map $self->$_, qw( condition op params ) ];
+ [ map $self->$_, qw( condition
name
op params ) ];
}
=back
}
=back
diff --git
a/FS/bin/freeside-upgrade
b/FS/bin/freeside-upgrade
index
a0a5fe6
..
4a6fac2
100755
(executable)
--- a/
FS/bin/freeside-upgrade
+++ b/
FS/bin/freeside-upgrade
@@
-61,6
+61,33
@@
if (dbdef->table('cust_main')->column('agent_custid') && ! $opt_s) {
if (dbdef->table('h_cust_main'));
}
if (dbdef->table('h_cust_main'));
}
+if ( dbdef->table('cgp_rule_condition') &&
+ dbdef->table('cgp_rule_condition')->column('condition')
+ )
+{
+ push @bugfix,
+ "ALTER TABLE ${_}cgp_rule_condition RENAME COLUMN condition TO conditionname"
+ for '', 'h_';
+
+}
+
+if ( $DRY_RUN ) {
+ print
+ join(";\n", @bugfix ). ";\n";
+} elsif ( @bugfix ) {
+
+ foreach my $statement ( @bugfix ) {
+ warn "$statement\n";
+ $dbh->do( $statement )
+ or die "Error: ". $dbh->errstr. "\n executing: $statement";
+ }
+
+ dbdef_create($dbh, $dbdef_file);
+ delete $FS::Schema::dbdef_cache{$dbdef_file}; #force an actual reload
+ reload_dbdef($dbdef_file);
+
+}
+
#you should have run fs-migrate-part_svc ages ago, when you upgraded
#from 1.3 to 1.4... if not, it needs to be hooked into -upgrade here or
#you'll lose all the part_svc settings it migrates to part_svc_column
#you should have run fs-migrate-part_svc ages ago, when you upgraded
#from 1.3 to 1.4... if not, it needs to be hooked into -upgrade here or
#you'll lose all the part_svc settings it migrates to part_svc_column
@@
-83,10
+110,10
@@
unless ( driver_name =~ /^mysql/i ) {
if ( $DRY_RUN ) {
print
if ( $DRY_RUN ) {
print
- join(";\n", @
bugfix, @
statements ). ";\n";
+ join(";\n", @statements ). ";\n";
exit;
} else {
exit;
} else {
- foreach my $statement ( @
bugfix, @
statements ) {
+ foreach my $statement ( @statements ) {
warn "$statement\n";
$dbh->do( $statement )
or die "Error: ". $dbh->errstr. "\n executing: $statement";
warn "$statement\n";
$dbh->do( $statement )
or die "Error: ". $dbh->errstr. "\n executing: $statement";
diff --git
a/httemplate/browse/cgp_rule.html
b/httemplate/browse/cgp_rule.html
index
6f7b3e0
..
5be6bb4
100644
(file)
--- a/
httemplate/browse/cgp_rule.html
+++ b/
httemplate/browse/cgp_rule.html
@@
-55,7
+55,7
@@
my $condition_sub = sub {
[ map {
[
[ map {
[
- { data => $_->condition,
+ { data => $_->condition
name
,
#align =>
},
{ data => $_->op,
#align =>
},
{ data => $_->op,
diff --git
a/httemplate/edit/cgp_rule.html
b/httemplate/edit/cgp_rule.html
index
d9c19a1
..
41275ab
100644
(file)
--- a/
httemplate/edit/cgp_rule.html
+++ b/
httemplate/edit/cgp_rule.html
@@
-51,7
+51,7
@@
my %opt = @_;
my $m2_error_callback_cond = sub {
my($cgi, $object) = @_;
my $m2_error_callback_cond = sub {
my($cgi, $object) = @_;
- my @fields = qw( condition op params );
+ my @fields = qw( condition
name
op params );
my @gfields = ( '', map "_$_", @fields );
map {
my @gfields = ( '', map "_$_", @fields );
map {
@@
-83,7
+83,7
@@
my $m2_error_callback_action = sub {
if ( /^ruleactionnum(\d+)$/ ) {
my $num = $1;
if ( grep $cgi->param("ruleactionnum$num$_"), @gfields ) {
if ( /^ruleactionnum(\d+)$/ ) {
my $num = $1;
if ( grep $cgi->param("ruleactionnum$num$_"), @gfields ) {
- my $x = new FS::cgp_rule_
condi
tion {
+ my $x = new FS::cgp_rule_
ac
tion {
'ruleactionnum' => $cgi->param("ruleactionnum$num"),
map { $_ => scalar($cgi->param("ruleactionnum${num}_$_")) } @fields,
};
'ruleactionnum' => $cgi->param("ruleactionnum$num"),
map { $_ => scalar($cgi->param("ruleactionnum${num}_$_")) } @fields,
};
diff --git
a/httemplate/edit/process/cgp_rule.html
b/httemplate/edit/process/cgp_rule.html
index
f427b6c
..
9653413
100644
(file)
--- a/
httemplate/edit/process/cgp_rule.html
+++ b/
httemplate/edit/process/cgp_rule.html
@@
-4,7
+4,7
@@
'process_o2m' => [
{
'table' => 'cgp_rule_condition',
'process_o2m' => [
{
'table' => 'cgp_rule_condition',
- 'fields' => [qw( condition op params )],
+ 'fields' => [qw( condition
name
op params )],
},
{
'table' => 'cgp_rule_action',
},
{
'table' => 'cgp_rule_action',
diff --git
a/httemplate/elements/select-cgp_rule_condition.html
b/httemplate/elements/select-cgp_rule_condition.html
index
622cbe8
..
bc96ab4
100644
(file)
--- a/
httemplate/elements/select-cgp_rule_condition.html
+++ b/
httemplate/elements/select-cgp_rule_condition.html
@@
-3,10
+3,10
@@
<INPUT TYPE="hidden" NAME="<%$name%>" ID="<%$id%>" VALUE="<% $curr_value %>">
<% include( 'select.html',
<INPUT TYPE="hidden" NAME="<%$name%>" ID="<%$id%>" VALUE="<% $curr_value %>">
<% include( 'select.html',
- 'field' => $name.'_condition',
- 'id' => $id.'_condition',
+ 'field' => $name.'_condition
name
',
+ 'id' => $id.'_condition
name
',
'options' => \@conditions,
'options' => \@conditions,
- 'curr_value' => $condition,
+ 'curr_value' => $condition
name
,
'labels' => { '' => 'Select Condition' },
'onchange' => $name.'_changed',
)
'labels' => { '' => 'Select Condition' },
'onchange' => $name.'_changed',
)
@@
-189,10
+189,10
@@
if ( $curr_value ) {
$cgp_rule_condition = new FS::cgp_rule_condition {};
}
$cgp_rule_condition = new FS::cgp_rule_condition {};
}
-my $condition
= scalar($cgi->param($name.'_condition
'))
-
|| $cgp_rule_condition->condition
;
+my $condition
name = scalar($cgi->param($name.'_conditionname
'))
+
|| $cgp_rule_condition->conditionname
;
-my @op = &$cond2op($condition);
+my @op = &$cond2op($condition
name
);
my $disabled = scalar(@op) ? '' : 1;
my $style = $disabled ? 'visibility:hidden' : '';
my $disabled = scalar(@op) ? '' : 1;
my $style = $disabled ? 'visibility:hidden' : '';