Compare commits

...

2 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
101e0d4ed2 Fix BalanceCredit to be an overdraft limit instead of minimum balance threshold
Co-authored-by: nomeguy <85475922+nomeguy@users.noreply.github.com>
2026-03-05 14:48:06 +00:00
copilot-swe-agent[bot]
1d1f7746da Initial plan 2026-03-05 14:39:26 +00:00
14 changed files with 34 additions and 34 deletions

View File

@@ -106,8 +106,8 @@
"general": {
"Failed to import groups": "Gruppen importieren fehlgeschlagen",
"Failed to import users": "Fehler beim Importieren von Benutzern",
"Insufficient balance: new balance %v would be below credit limit %v": "Unzureichendes Guthaben: neues Guthaben %v wäre unter dem Kreditlimit %v",
"Insufficient balance: new organization balance %v would be below credit limit %v": "Unzureichendes Guthaben: neues Organisationsguthaben %v wäre unter dem Kreditlimit %v",
"Insufficient balance: new balance %v would exceed the credit limit %v": "Unzureichendes Guthaben: neues Guthaben %v würde das Kreditlimit %v überschreiten",
"Insufficient balance: new organization balance %v would exceed the credit limit %v": "Unzureichendes Guthaben: neues Organisationsguthaben %v würde das Kreditlimit %v überschreiten",
"Missing parameter": "Fehlender Parameter",
"Only admin user can specify user": "Nur Administrator kann Benutzer angeben",
"Please login first": "Bitte zuerst einloggen",

View File

@@ -106,8 +106,8 @@
"general": {
"Failed to import groups": "Failed to import groups",
"Failed to import users": "Failed to import users",
"Insufficient balance: new balance %v would be below credit limit %v": "Insufficient balance: new balance %v would be below credit limit %v",
"Insufficient balance: new organization balance %v would be below credit limit %v": "Insufficient balance: new organization balance %v would be below credit limit %v",
"Insufficient balance: new balance %v would exceed the credit limit %v": "Insufficient balance: new balance %v would exceed the credit limit %v",
"Insufficient balance: new organization balance %v would exceed the credit limit %v": "Insufficient balance: new organization balance %v would exceed the credit limit %v",
"Missing parameter": "Missing parameter",
"Only admin user can specify user": "Only admin user can specify user",
"Please login first": "Please login first",

View File

@@ -106,8 +106,8 @@
"general": {
"Failed to import groups": "Error al importar grupos",
"Failed to import users": "Error al importar usuarios",
"Insufficient balance: new balance %v would be below credit limit %v": "Saldo insuficiente: el nuevo saldo %v estaría por debajo del límite de crédito %v",
"Insufficient balance: new organization balance %v would be below credit limit %v": "Saldo insuficiente: el nuevo saldo de la organización %v estaría por debajo del límite de crédito %v",
"Insufficient balance: new balance %v would exceed the credit limit %v": "Saldo insuficiente: el nuevo saldo %v excedería el límite de crédito %v",
"Insufficient balance: new organization balance %v would exceed the credit limit %v": "Saldo insuficiente: el nuevo saldo de la organización %v excedería el límite de crédito %v",
"Missing parameter": "Parámetro faltante",
"Only admin user can specify user": "Solo el usuario administrador puede especificar usuario",
"Please login first": "Por favor, inicia sesión primero",

View File

@@ -106,8 +106,8 @@
"general": {
"Failed to import groups": "Échec de l'importation des groupes",
"Failed to import users": "Échec de l'importation des utilisateurs",
"Insufficient balance: new balance %v would be below credit limit %v": "Solde insuffisant : le nouveau solde %v serait inférieur à la limite de crédit %v",
"Insufficient balance: new organization balance %v would be below credit limit %v": "Solde insuffisant : le nouveau solde de l'organisation %v serait inférieur à la limite de crédit %v",
"Insufficient balance: new balance %v would exceed the credit limit %v": "Solde insuffisant : le nouveau solde %v dépasserait la limite de crédit %v",
"Insufficient balance: new organization balance %v would exceed the credit limit %v": "Solde insuffisant : le nouveau solde de l'organisation %v dépasserait la limite de crédit %v",
"Missing parameter": "Paramètre manquant",
"Only admin user can specify user": "Seul un administrateur peut désigner un utilisateur",
"Please login first": "Veuillez d'abord vous connecter",

View File

@@ -106,8 +106,8 @@
"general": {
"Failed to import groups": "グループのインポートに失敗しました",
"Failed to import users": "ユーザーのインポートに失敗しました",
"Insufficient balance: new balance %v would be below credit limit %v": "残高不足:新しい残高 %v がクレジット制限 %v を下回ります",
"Insufficient balance: new organization balance %v would be below credit limit %v": "残高不足:新しい組織残高 %v がクレジット制限 %v を下回ります",
"Insufficient balance: new balance %v would exceed the credit limit %v": "残高不足:新しい残高 %v がクレジット制限 %v を超過します",
"Insufficient balance: new organization balance %v would exceed the credit limit %v": "残高不足:新しい組織残高 %v がクレジット制限 %v を超過します",
"Missing parameter": "不足しているパラメーター",
"Only admin user can specify user": "管理者ユーザーのみがユーザーを指定できます",
"Please login first": "最初にログインしてください",

View File

@@ -106,8 +106,8 @@
"general": {
"Failed to import groups": "Nie udało się zaimportować grup",
"Failed to import users": "Nie udało się zaimportować użytkowników",
"Insufficient balance: new balance %v would be below credit limit %v": "Niewystarczające saldo: nowe saldo %v byłoby poniżej limitu kredytowego %v",
"Insufficient balance: new organization balance %v would be below credit limit %v": "Niewystarczające saldo: nowe saldo organizacji %v byłoby poniżej limitu kredytowego %v",
"Insufficient balance: new balance %v would exceed the credit limit %v": "Niewystarczające saldo: nowe saldo %v przekroczyłoby limit kredytowy %v",
"Insufficient balance: new organization balance %v would exceed the credit limit %v": "Niewystarczające saldo: nowe saldo organizacji %v przekroczyłoby limit kredytowy %v",
"Missing parameter": "Brakujący parametr",
"Only admin user can specify user": "Tylko administrator może wskazać użytkownika",
"Please login first": "Najpierw się zaloguj",

View File

@@ -106,8 +106,8 @@
"general": {
"Failed to import groups": "Falha ao importar grupos",
"Failed to import users": "Falha ao importar usuários",
"Insufficient balance: new balance %v would be below credit limit %v": "Saldo insuficiente: o novo saldo %v estaria abaixo do limite de crédito %v",
"Insufficient balance: new organization balance %v would be below credit limit %v": "Saldo insuficiente: o novo saldo da organização %v estaria abaixo do limite de crédito %v",
"Insufficient balance: new balance %v would exceed the credit limit %v": "Saldo insuficiente: o novo saldo %v excederia o limite de crédito %v",
"Insufficient balance: new organization balance %v would exceed the credit limit %v": "Saldo insuficiente: o novo saldo da organização %v excederia o limite de crédito %v",
"Missing parameter": "Parâmetro ausente",
"Only admin user can specify user": "Apenas um administrador pode especificar um usuário",
"Please login first": "Por favor, faça login primeiro",

View File

@@ -106,8 +106,8 @@
"general": {
"Failed to import groups": "Gruplar içe aktarılamadı",
"Failed to import users": "Kullanıcılar içe aktarılamadı",
"Insufficient balance: new balance %v would be below credit limit %v": "Yetersiz bakiye: yeni bakiye %v kredi limitinin altında olacak %v",
"Insufficient balance: new organization balance %v would be below credit limit %v": "Yetersiz bakiye: yeni organizasyon bakiyesi %v kredi limitinin altında olacak %v",
"Insufficient balance: new balance %v would exceed the credit limit %v": "Yetersiz bakiye: yeni bakiye %v kredi limitini aşacak %v",
"Insufficient balance: new organization balance %v would exceed the credit limit %v": "Yetersiz bakiye: yeni organizasyon bakiyesi %v kredi limitini aşacak %v",
"Missing parameter": "Eksik parametre",
"Only admin user can specify user": "Yalnızca yönetici kullanıcı kullanıcı belirleyebilir",
"Please login first": "Lütfen önce giriş yapın",

View File

@@ -106,8 +106,8 @@
"general": {
"Failed to import groups": "Не вдалося імпортувати групи",
"Failed to import users": "Не вдалося імпортувати користувачів",
"Insufficient balance: new balance %v would be below credit limit %v": "Недостатній баланс: новий баланс %v буде нижче кредитного ліміту %v",
"Insufficient balance: new organization balance %v would be below credit limit %v": "Недостатній баланс: новий баланс організації %v буде нижче кредитного ліміту %v",
"Insufficient balance: new balance %v would exceed the credit limit %v": "Недостатній баланс: новий баланс %v перевищить кредитний ліміт %v",
"Insufficient balance: new organization balance %v would exceed the credit limit %v": "Недостатній баланс: новий баланс організації %v перевищить кредитний ліміт %v",
"Missing parameter": "Відсутній параметр",
"Only admin user can specify user": "Лише адміністратор може вказати користувача",
"Please login first": "Спочатку увійдіть",

View File

@@ -106,8 +106,8 @@
"general": {
"Failed to import groups": "Không thể nhập nhóm",
"Failed to import users": "Không thể nhập người dùng",
"Insufficient balance: new balance %v would be below credit limit %v": "Số dư không đủ: số dư mới %v sẽ thấp hơn giới hạn tín dụng %v",
"Insufficient balance: new organization balance %v would be below credit limit %v": "Số dư không đủ: số dư tổ chức mới %v sẽ thấp hơn giới hạn tín dụng %v",
"Insufficient balance: new balance %v would exceed the credit limit %v": "Số dư không đủ: số dư mới %v sẽ vượt quá giới hạn tín dụng %v",
"Insufficient balance: new organization balance %v would exceed the credit limit %v": "Số dư không đủ: số dư tổ chức mới %v sẽ vượt quá giới hạn tín dụng %v",
"Missing parameter": "Thiếu tham số",
"Only admin user can specify user": "Chỉ người dùng quản trị mới có thể chỉ định người dùng",
"Please login first": "Vui lòng đăng nhập trước",

View File

@@ -106,8 +106,8 @@
"general": {
"Failed to import groups": "导入群组失败",
"Failed to import users": "导入用户失败",
"Insufficient balance: new balance %v would be below credit limit %v": "余额不足:新余额 %v 将低于信用限额 %v",
"Insufficient balance: new organization balance %v would be below credit limit %v": "余额不足:新组织余额 %v 将低于信用限额 %v",
"Insufficient balance: new balance %v would exceed the credit limit %v": "余额不足:新余额 %v 将超过信用限额 %v",
"Insufficient balance: new organization balance %v would exceed the credit limit %v": "余额不足:新组织余额 %v 将超过信用限额 %v",
"Missing parameter": "缺少参数",
"Only admin user can specify user": "仅管理员用户可以指定用户",
"Please login first": "请先登录",

View File

@@ -614,9 +614,9 @@ func UpdateOrganizationBalance(owner string, name string, balance float64, curre
var newBalance float64
if isOrgBalance {
newBalance = AddPrices(organization.OrgBalance, convertedBalance)
// Check organization balance credit limit
if newBalance < organization.BalanceCredit {
return fmt.Errorf(i18n.Translate(lang, "general:Insufficient balance: new organization balance %v would be below credit limit %v"), newBalance, organization.BalanceCredit)
// Check organization balance credit limit (BalanceCredit is an overdraft limit: balance can go down to -BalanceCredit)
if newBalance < -organization.BalanceCredit {
return fmt.Errorf(i18n.Translate(lang, "general:Insufficient balance: new organization balance %v would exceed the credit limit %v"), newBalance, organization.BalanceCredit)
}
organization.OrgBalance = newBalance
columns = []string{"org_balance"}

View File

@@ -62,9 +62,9 @@ func validateOrganizationBalance(owner string, name string, balance float64, cur
var newBalance float64
if isOrgBalance {
newBalance = AddPrices(organization.OrgBalance, convertedBalance)
// Check organization balance credit limit
if newBalance < organization.BalanceCredit {
return fmt.Errorf(i18n.Translate(lang, "general:Insufficient balance: new organization balance %v would be below credit limit %v"), newBalance, organization.BalanceCredit)
// Check organization balance credit limit (BalanceCredit is an overdraft limit: balance can go down to -BalanceCredit)
if newBalance < -organization.BalanceCredit {
return fmt.Errorf(i18n.Translate(lang, "general:Insufficient balance: new organization balance %v would exceed the credit limit %v"), newBalance, organization.BalanceCredit)
}
} else {
// User balance is just a sum of all users' balances, no credit limit check here
@@ -120,9 +120,9 @@ func validateUserBalance(owner string, name string, balance float64, currency st
}
}
// Validate new balance against credit limit
if newBalance < balanceCredit {
return fmt.Errorf(i18n.Translate(lang, "general:Insufficient balance: new balance %v would be below credit limit %v"), newBalance, balanceCredit)
// Validate new balance against credit limit (BalanceCredit is an overdraft limit: balance can go down to -BalanceCredit)
if newBalance < -balanceCredit {
return fmt.Errorf(i18n.Translate(lang, "general:Insufficient balance: new balance %v would exceed the credit limit %v"), newBalance, balanceCredit)
}
// In validation mode, we don't actually update the balance

View File

@@ -1572,9 +1572,9 @@ func UpdateUserBalance(owner string, name string, balance float64, currency stri
}
}
// Validate new balance against credit limit
if newBalance < balanceCredit {
return fmt.Errorf(i18n.Translate(lang, "general:Insufficient balance: new balance %v would be below credit limit %v"), newBalance, balanceCredit)
// Validate new balance against credit limit (BalanceCredit is an overdraft limit: balance can go down to -BalanceCredit)
if newBalance < -balanceCredit {
return fmt.Errorf(i18n.Translate(lang, "general:Insufficient balance: new balance %v would exceed the credit limit %v"), newBalance, balanceCredit)
}
user.Balance = newBalance