[error] [client 127.0.0.1] Use of uninitialized value in split at ./pro/mscqtn_input.pl line 614,
614:@{ $t{pid_list} } = split(/=/,$t{partsid});
------------------------------------------
[error] [client 127.0.0.1] Use of uninitialized value in concatenation (.) or string at ./pro/mscqtn_input.pl line 698,
698: $t{line1} .= '" value="' . $t{dd1} . '">';
跟enq2 table的discount项目有关(注意其赋值情况)
------------------------------------------
[error] [client 127.0.0.1] Argument "" isn't numeric in numeric ne (!=) at ./pro/mscqtn_input.pl line 110
110: if ( $t{pl1}[$n] != 0 ) {
修改如下
110: if ( $t{pl1}[$n] ) {
145: if ( $t{pl1}[$n] != 0 ) {
修改如下
145: if ( $t{pl1}[$n] ) {
[error] [client 127.0.0.1] Argument "" isn't numeric in numeric ne (!=) at ./pro/mscqtn_input.pl line 581
581: if ( $t{pl1}[$n] != 0 ) {
修改如下
581: if ( $t{pl1}[$n] ) {
mscqtn_input.htm修改
mscqtn_input.pl修改
mysql> show columns from enq2;
+------------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+---------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| time | date | YES | | NULL | |
| enq1id | int(11) | YES | | NULL | |
| LANGUAGEid | int(11) | YES | | NULL | |
| ORIGINid | int(11) | YES | | NULL | |
| PRICEid | int(11) | YES | | NULL | |
| PAYMENTid | int(11) | YES | | NULL | |
| makerid | int(11) | YES | | NULL | |
| DELIVERY | text | YES | | NULL | |
| type1id | text | YES | | NULL | |
| partsid | text | YES | | NULL | |
| QTY | text | YES | | NULL | |
| memo | text | YES | | NULL | |
| price | text | YES | | NULL | |
| discount | text | YES | | NULL | |
| discount0 | int(11) | YES | | NULL | |
| money | int(11) | YES | | NULL | |
| price1 | text | YES | | NULL | |
| makerref | text | YES | | NULL | |
| disc | text | YES | | NULL | |
| charges | text | YES | | NULL | |
+------------+---------+------+-----+---------+----------------+
21 rows in set (0.06 sec)
[Sun Sep 12 12:31:37 2010] [error] [client 127.0.0.1] Argument "C" isn't numeric in numeric ne (!=) at ./pro/mscqtn_input.pl line 568, line 11., referer: http://localhost/cgi-bin/msc_start.cgi
[Sun Sep 12 12:31:37 2010] [error] [client 127.0.0.1] Argument "" isn't numeric in addition (+) at ./pro/mscqtn_input.pl line 430, line 11., referer: http://localhost/cgi-bin/msc_start.cgi
430: $t{total} = $$pref{total}+$t{charges}+$t{disc};
修改如下:
if ($t{e2}[19]) {
$t{disc} = $t{e2}[19];
} else {
$t{disc} = 0;
}
$t{pl2} = 0;
@{ $t{pl1} } = split(/=/,$t{partsid});
for $n ( 0 .. $#{ $t{pl1} } ) {
568: if ( $t{pl1}[$n] != 0 ) {
$t{pl2}++;
}
}
相同code时的价格输入问题
mscqtn_input.htm,pat=price,=>mscqtn_input.pl
checkbox的checked
# mscqtn_input.pl
$t{enq1_select} = 'enq1_select';
##------挑选全部零件
} elsif ( $t{pat} eq 'selectall' ) {
$t{enq1_select} = 'enq1_selectall';
}
# 显示对应enq1的所有零件供挑选
$$pref{mode} = $t{enq1_select};
# mscenq1.pl
} elsif ( $$pref{mode} eq 'enq1_select' ) {
$t{check1} = 'c_t' . $t{type1id} . '_d' . $t{dwg1} . '_p' . $t{pid1};
$t{line1} .= ' ' . $t{check1} . ' ';
} elsif ( $$pref{mode} eq 'enq1_selectall' ) { # 增加的部分
$t{check1} = 'c_t' . $t{type1id} . '_d' . $t{dwg1} . '_p' . $t{pid1};
$t{line1} .= ' ' . $t{check1} . ' ';
}
use strict;
my(%t,$valid,$val,$n);
$t{list}[0] = '22';
$t{list}[1] = '1.22.3';
$t{list}[2] = '私22.';
$t{list}[3] = '22.3私';
$t{list}[4] = '1.223';
for $n ( 0 .. $#{ $t{list} } ) {
$val = $t{list}[$n];
$valid = is_price($val);
if ( $valid ) {
print "$val is OK,$valid\n";
} else {
print "$val is NOT OK!$valid\n";
}
}
sub is_price {
my $s = shift;
my $data;
$data = 0;
if ( $s =~ /^\+?(\d+)/ ) {
$data = $1;
}
if ( $s =~ /^\+?(\d+\.\d+)/ ) {
$data = $1;
}
if ( $s =~ /^\+?\d+\.\d+\./ ) {
$data = 0;
}
return ( $data );;
}
22 is OK,22
1.22.3 is NOT OK!0
私22. is NOT OK!0
22.3私 is OK,22.3
1.223 is OK,1.223
use strict;
my(%t,$valid,$val,$n);
$t{list}[0] = '22';
$t{list}[1] = '1.22.3';
$t{list}[2] = '私22.';
$t{list}[3] = '22.3私';
for $n ( 0 .. $#{ $t{list} } ) {
$val = $t{list}[$n];
$valid = is_price($val);
if ( $valid ) {
print "$val is OK,$valid\n";
} else {
print "$val is NOT OK!$valid\n";
}
}
sub is_price {
my $s = shift;
my $data;
$data = 0;
if ( $s =~ /^\+?(\d+)/ ) {
$data = $1;
}
if ( $s =~ /^\+?(\d+\.\d+)/ ) {
$data = $1;
}
return ( $data );;
}
22 is OK,22
1.22.3 is OK,1.22
私22. is NOT OK!0
22.3私 is OK,22.3
# 判定一个数字
sub is_number {
my $s = shift;
return ( ($s =~ /^\+?\d+$/ or $s =~ /^\+?\d+\.\d*$/ ) && $s > 0 );
}
#---------输入价格
} elsif ( $t{pat} eq 'price' ) {
# 货币单位
$t{money1} = $t{q}->param("money1");
$t{sql} = 'UPDATE enq2 set money = "';
$t{sql} .= $t{money1} . '" where id = ';
$t{sql} .= $t{enq2_id};
$t{DO} = $self->dbh->do($t{sql});
# 输入内容
$t{partsprice} = $t{q}->param("partsprice");
@{ $t{prices} } = split(/\r\n/,$t{partsprice});
$t{valids} = -1;
for $n ( 0 .. $#{ $t{prices} } ) {
$t{prices_test} = $t{prices}[$n];
$t{valid1} = is_number($t{prices_test});
if ( $t{valid1} == 1 ) {
$t{valids}++;
}
}
if ( $t{valids} == $#{ $t{prices} } ) {
$t{valid} = 1;
} else {
$t{valid} = 0;
}
if ( $t{valid} == 0 ) {
$t{price_input} = '输入价格中含有非数字符号。检查后重新输入。';
} else {
$t{prices_length} = $#{ $t{prices} } + 1;
# 取得主机和零件
($t{type1id},$t{partsid}) = $self->dbh->selectrow_array("SELECT type1id,partsid FROM enq2 WHERE id = $t{enq2_id}");
# 取得零件数量
$t{pl2} = 0;
@{ $t{pl1} } = split(/=/,$t{partsid});
for $n ( 0 .. $#{ $t{pl1} } ) {
if ( $t{pl1}[$n] ) {
$t{pl2}++;
}
}
if ( $t{prices_length} != $t{pl2} ) {
$t{price_input} = '输入价格的数量与零件数量不符。检查后重新输入。';
} else {
$t{price_input} = '输入价格成功!';
# enq2に書き込む
$t{price} = join('=',@{ $t{prices} });
$t{sql} = 'UPDATE enq2 set price ="';
$t{sql} .= $t{price} . '" where id = ';
$t{sql} .= $t{enq2_id};
$t{DO} = $self->dbh->do($t{sql});
# 時間を更新
# 取得时间
$a_ref = obtain_time($a_ref);
$t{time1} = $$a_ref{time1};
$t{sql} = 'UPDATE enq2 set time ="';
$t{sql} .= $t{time1} . '" where id = ';
$t{sql} .= $t{enq2_id};
$t{DO} = $self->dbh->do($t{sql});
}
}
# test_inputdata.pl
use strict;
my(%t,$valid,$val,$n);
@{ $t{list} } = qw/33 -33 '33' 33.3 33.444 33. 34.0/;
for $n ( 0 .. $#{ $t{list} } ) {
$val = $t{list}[$n];
$valid = is_price($val);
if ( $valid ) {
print "$val is OK\n";
} else {
print "$val is NOT OK!\n";
}
}
sub is_price {
my $s = shift;
return ( ($s =~ /^\+?\d+$/ or $s =~ /^\+?\d+\.\d*$/ ) && $s > 0 );
}
运行结果
33 is OK
-33 is NOT OK!
'33' is NOT OK!
33.3 is OK
33.444 is OK
33. is OK
34.0 is OK
$valid = is_number($input_data);
sub is_number {
my $s = shift;
return( $s =~ /^\+?\d+$/ );
}
#---------输入价格
} elsif ( $t{pat} eq 'price' ) {
# 货币单位
$t{money1} = $t{q}->param("money1");
$t{sql} = 'UPDATE enq2 set money = "';
$t{sql} .= $t{money1} . '" where id = ';
$t{sql} .= $t{enq2_id};
$t{DO} = $self->dbh->do($t{sql});
# 输入内容
$t{partsprice} = $t{q}->param("partsprice");
@{ $t{prices} } = split(/\r\n/,$t{partsprice});
$t{prices_test} = join('',@{ $t{prices} });
$t{valid} = is_number($t{prices_test});
if ( $t{valid} == 0 ) {
$t{price_input} = '输入价格中含有非数字符号。检查后重新输入。';
} else {
$t{prices_length} = $#{ $t{prices} } + 1;
# 取得主机和零件
($t{type1id},$t{partsid}) = $self->dbh->selectrow_array("SELECT type1id,partsid FROM enq2 WHERE id = $t{enq2_id}");
# 取得零件数量
$t{pl2} = 0;
@{ $t{pl1} } = split(/=/,$t{partsid});
for $n ( 0 .. $#{ $t{pl1} } ) {
if ( $t{pl1}[$n] ) {
$t{pl2}++;
}
}
if ( $t{prices_length} != $t{pl2} ) {
$t{price_input} = '输入价格的数量与零件数量不符。检查后重新输入。';
} else {
$t{price_input} = '输入价格成功!';
# enq2に書き込む
$t{price} = join('=',@{ $t{prices} });
$t{sql} = 'UPDATE enq2 set price ="';
$t{sql} .= $t{price} . '" where id = ';
$t{sql} .= $t{enq2_id};
$t{DO} = $self->dbh->do($t{sql});
# 時間を更新
# 取得时间
$a_ref = obtain_time($a_ref);
$t{time1} = $$a_ref{time1};
$t{sql} = 'UPDATE enq2 set time ="';
$t{sql} .= $t{time1} . '" where id = ';
$t{sql} .= $t{enq2_id};
$t{DO} = $self->dbh->do($t{sql});
}
}
返回