diff --git a/dev/translation/ignore_translation_keys.lst b/dev/translation/ignore_translation_keys.lst index d85ac6636da..506c03fab85 100644 --- a/dev/translation/ignore_translation_keys.lst +++ b/dev/translation/ignore_translation_keys.lst @@ -676,7 +676,6 @@ RECUR RSS RateIndirect Re-Open -Rechercher ReconciledBy RecordNotFound RecruitmentJobPosition @@ -808,8 +807,6 @@ SupplierMissingRef Synchronize Syslog TLS/STARTTLS -TLSv1 -TLSv1.2 TYPE_ Tabs Tag diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index a80dc11596a..952ac0f902e 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -8,8 +8,8 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2021-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2021-2025 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1347,7 +1347,7 @@ if ($mode == 'marketplace') {
- + ">trans('Reset') ?>   diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index a41b8a3cc42..f1e60578050 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -817,6 +817,8 @@ class FormSetupItem $val_const = GETPOST($this->confKey, 'restricthtml'); } elseif ($this->type == 'email') { $val_const = GETPOST($this->confKey, 'alphawithlgt'); + } elseif ($this->type == 'number') { + $val_const = GETPOSTINT($this->confKey); } else { $val_const = GETPOST($this->confKey, 'alphanohtml'); } @@ -1411,6 +1413,31 @@ class FormSetupItem return $this; } + /** + * Set type of input as number + * @param int $min minimum value for input number + * @param int $max maximum value for input number + * @param int $step legal number intervals + * + * @return self + */ + public function setAsNumber($min = null, $max = null, $step = null) + { + $this->type = 'number'; //for GETPOSTINT + $this->fieldAttr['type'] = 'number'; //generic thanks to generateAttributesStringFromArray + if (!is_null($min)) { + $this->fieldAttr['min'] = $min; + } + if (!is_null($max)) { + $this->fieldAttr['max'] = $max; + } + if (!is_null($step)) { + $this->fieldAttr['step'] = $step; + } + return $this; + } + + /** * Set type of input as string * diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 64deb435293..0ea9626f17f 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -406,14 +406,40 @@ if (empty($reshook)) { if (!empty($listofbills)) { $nbwithdrawrequestok = 0; foreach ($listofbills as $aBill) { - $db->begin(); - $result = $aBill->demande_prelevement($user, $aBill->resteapayer, 'bank-transfer', 'supplier_invoice'); - if ($result > 0) { - $db->commit(); - $nbwithdrawrequestok++; - } else { - $db->rollback(); + $pendingAmount = 0; + $sqlPending = "SELECT SUM(pfd.amount) as amount"; + $sqlPending .= " FROM ".$db->prefix()."prelevement_demande as pfd"; + $sqlPending .= " LEFT JOIN ".$db->prefix()."prelevement_lignes as pl ON pfd.fk_prelevement_bons = pl.fk_prelevement_bons"; + $sqlPending .= " WHERE fk_facture_fourn = ".((int) $aBill->id); + $sqlPending .= " AND (pl.statut IS NULL OR pl.statut = 0)"; + $sqlPending .= " AND pfd.type = 'ban'"; + $resPending = $db->query($sqlPending); + if (!$resPending) { + $aBill->error = $db->lasterror(); + $aBill->errors[] = $aBill->error; setEventMessages($aBill->error, $aBill->errors, 'errors'); + } else { + if ($objPending = $db->fetch_object($resPending)) { + $pendingAmount = (float) $objPending->amount; + } + $db->free($resPending); + + $requestAmount = $aBill->resteapayer - $pendingAmount; + if ($requestAmount > 0) { + $db->begin(); + $result = $aBill->demande_prelevement($user, $requestAmount, 'bank-transfer', 'supplier_invoice'); + if ($result > 0) { + $db->commit(); + $nbwithdrawrequestok++; + } else { + $db->rollback(); + setEventMessages($aBill->error, $aBill->errors, 'errors'); + } + } else { + $aBill->error = 'WithdrawRequestErrorNilAmount'; + $aBill->errors[] = $aBill->error; + setEventMessages($aBill->error, $aBill->errors, 'errors'); + } } } if ($nbwithdrawrequestok > 0) { diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index fbb3dab2265..75b3461e42d 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -374,3 +374,5 @@ RephraseStyleProfessional=Professional style RephraseStyleHumouristic=Humouristic style TextRephraser=Text style rephraser AIEnhancements=AI Enhancements +TLSv1=TLSv1 +TLSv1.2=TLSv1.2