Lines 956-992
sub ConvertCurrency {
Link Here
|
956 |
return ( $price / $cur ); |
956 |
return ( $price / $cur ); |
957 |
} |
957 |
} |
958 |
|
958 |
|
959 |
=head2 _columns |
|
|
960 |
|
961 |
returns an array containing fieldname followed by PRI as value if PRIMARY Key |
962 |
|
963 |
=cut |
964 |
|
965 |
sub _columns(;$) { |
966 |
my $tablename=shift||"aqbudgets"; |
967 |
return @{C4::Context->dbh->selectcol_arrayref("SHOW columns from $tablename",{Columns=>[1,4]})}; |
968 |
} |
969 |
|
970 |
sub _filter_fields{ |
971 |
my $budget=shift; |
972 |
my $tablename=shift; |
973 |
my @keys; |
974 |
my @values; |
975 |
my %columns= _columns($tablename); |
976 |
#Filter Primary Keys of table |
977 |
my $elements=join "|",grep {$columns{$_} ne "PRI"} keys %columns; |
978 |
foreach my $field (grep {/\b($elements)\b/} keys %$budget){ |
979 |
$$budget{$field}=format_date_in_iso($$budget{$field}) if ($field=~/date/ && $$budget{$field} !~C4::Dates->regexp("iso")); |
980 |
my $strkeys= " $field = ? "; |
981 |
if ($field=~/branch/){ |
982 |
$strkeys="( $strkeys OR $field='' OR $field IS NULL) "; |
983 |
} |
984 |
push @values, $$budget{$field}; |
985 |
push @keys, $strkeys; |
986 |
} |
987 |
return (\@keys,\@values); |
988 |
} |
989 |
|
990 |
END { } # module clean-up code here (global destructor) |
959 |
END { } # module clean-up code here (global destructor) |
991 |
|
960 |
|
992 |
1; |
961 |
1; |
993 |
- |
|
|