文件操作 - useDonationAmounts.ts
返回文件管理
返回主菜单
删除本文件
文件: /home/www/public/wp-content/plugins/give/src/Donations/resources/hooks/useDonationAmounts.ts
编辑文件内容
import { Donation } from '@givewp/donations/admin/components/types'; import { getDonationOptionsWindowData } from '@givewp/donations/utils'; import {amountFormatter} from '@givewp/admin/utils'; /** * This hook is used to get the donation amounts and the formatter for the donation amounts. * @since 4.6.0 */ export default function useDonationAmounts(donation: Donation) { const {currency: baseCurrency, eventTicketsEnabled} = getDonationOptionsWindowData(); const donationAmountValue = Number(donation?.amount?.value ?? 0); const feeAmountRecoveredValue = Number(donation?.feeAmountRecovered?.value ?? 0); const eventTicketsAmountValue = Number(donation?.eventTicketsAmount?.value ?? 0); const intendedAmountValue = (donationAmountValue - feeAmountRecoveredValue) - (eventTicketsEnabled ? eventTicketsAmountValue : 0); const currency = donation?.amount?.currency ?? baseCurrency; return { baseCurrency, formatter: amountFormatter(currency), amount: donationAmountValue, intendedAmount: intendedAmountValue, feeAmountRecovered: feeAmountRecoveredValue, eventTicketsAmount: eventTicketsAmountValue, }; }
修改文件时间
将文件时间修改为当前时间的前一年
删除文件