Lines 981-1017
sub ConvertCurrency {
Link Here
|
981 |
return ( $price / $cur ); |
981 |
return ( $price / $cur ); |
982 |
} |
982 |
} |
983 |
|
983 |
|
984 |
=head2 _columns |
|
|
985 |
|
986 |
returns an array containing fieldname followed by PRI as value if PRIMARY Key |
987 |
|
988 |
=cut |
989 |
|
990 |
sub _columns(;$) { |
991 |
my $tablename=shift||"aqbudgets"; |
992 |
return @{C4::Context->dbh->selectcol_arrayref("SHOW columns from $tablename",{Columns=>[1,4]})}; |
993 |
} |
994 |
|
995 |
sub _filter_fields{ |
996 |
my $budget=shift; |
997 |
my $tablename=shift; |
998 |
my @keys; |
999 |
my @values; |
1000 |
my %columns= _columns($tablename); |
1001 |
#Filter Primary Keys of table |
1002 |
my $elements=join "|",grep {$columns{$_} ne "PRI"} keys %columns; |
1003 |
foreach my $field (grep {/\b($elements)\b/} keys %$budget){ |
1004 |
$$budget{$field}=format_date_in_iso($$budget{$field}) if ($field=~/date/ && $$budget{$field} !~C4::Dates->regexp("iso")); |
1005 |
my $strkeys= " $field = ? "; |
1006 |
if ($field=~/branch/){ |
1007 |
$strkeys="( $strkeys OR $field='' OR $field IS NULL) "; |
1008 |
} |
1009 |
push @values, $$budget{$field}; |
1010 |
push @keys, $strkeys; |
1011 |
} |
1012 |
return (\@keys,\@values); |
1013 |
} |
1014 |
|
1015 |
END { } # module clean-up code here (global destructor) |
984 |
END { } # module clean-up code here (global destructor) |
1016 |
|
985 |
|
1017 |
1; |
986 |
1; |
1018 |
- |
|
|