Lines 59-66
BEGIN {
Link Here
|
59 |
|
59 |
|
60 |
&ModBudgetPlan |
60 |
&ModBudgetPlan |
61 |
|
61 |
|
62 |
&ConvertCurrency |
|
|
63 |
|
64 |
&GetBudgetsPlanCell |
62 |
&GetBudgetsPlanCell |
65 |
&AddBudgetPlanValue |
63 |
&AddBudgetPlanValue |
66 |
&GetBudgetAuthCats |
64 |
&GetBudgetAuthCats |
Lines 913-949
sub CanUserModifyBudget {
Link Here
|
913 |
return 1; |
911 |
return 1; |
914 |
} |
912 |
} |
915 |
|
913 |
|
916 |
# ------------------------------------------------------------------- |
|
|
917 |
|
918 |
=head2 ConvertCurrency |
919 |
|
920 |
$foreignprice = &ConvertCurrency($currency, $localprice); |
921 |
|
922 |
Converts the price C<$localprice> to foreign currency C<$currency> by |
923 |
dividing by the exchange rate, and returns the result. |
924 |
|
925 |
If no exchange rate is found, e is one to one. |
926 |
|
927 |
=cut |
928 |
|
929 |
sub ConvertCurrency { |
930 |
my ( $currency, $price ) = @_; |
931 |
my $dbh = C4::Context->dbh; |
932 |
my $query = " |
933 |
SELECT rate |
934 |
FROM currency |
935 |
WHERE currency=? |
936 |
"; |
937 |
my $sth = $dbh->prepare($query); |
938 |
$sth->execute($currency); |
939 |
my $cur = ( $sth->fetchrow_array() )[0]; |
940 |
unless ($cur) { |
941 |
$cur = 1; |
942 |
} |
943 |
return ( $price / $cur ); |
944 |
} |
945 |
|
946 |
|
947 |
=head2 CloneBudgetPeriod |
914 |
=head2 CloneBudgetPeriod |
948 |
|
915 |
|
949 |
my $new_budget_period_id = CloneBudgetPeriod({ |
916 |
my $new_budget_period_id = CloneBudgetPeriod({ |