diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index e1704ac4cbf..6be3376920b 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -689,6 +689,7 @@ class Translate try { // @phan-suppress-next-line PhanPluginPrintfVariableFormatString $str = sprintf($str, $param1, $param2, $param3, $param4); // Replace %s and %d except for FormatXXX strings. + // Note: the catch ValueError is possible only when php min will be 8.1 } catch (Exception $e) { // No exception managed } @@ -804,8 +805,9 @@ class Translate try { // @phan-suppress-next-line PhanPluginPrintfVariableFormatString $str = sprintf($str, $param1, $param2, $param3, $param4, $param5); // Replace %s and %d except for FormatXXX strings. + // Note: the catch ValueError is possible only when php min will be 8.1 } catch (Exception $e) { - // No exception managed + // No exception managed. } } diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index e461d1330a6..db3b81ba061 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -997,7 +997,7 @@ class Salary extends CommonObject if (!$error) { // Force payment mode of invoice to withdraw - $payment_mode_id = dol_getIdFromCode($this->db, ($type == 'bank-transfer' ? 'VIR' : 'PRE'), 'c_paiement', 'code', 'id', 1); + $payment_mode_id = dol_getIdFromCode($this->db, (($type == 'bank-transfer' || $type == 'salaire') ? 'VIR' : 'PRE'), 'c_paiement', 'code', 'id', 1); if ($payment_mode_id > 0) { $result = $this->setPaymentMethods($payment_mode_id); } diff --git a/htdocs/salaries/virement_request.php b/htdocs/salaries/virement_request.php index 5c263db6345..8599ba4decb 100644 --- a/htdocs/salaries/virement_request.php +++ b/htdocs/salaries/virement_request.php @@ -162,6 +162,23 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } +// payment mode +if ($action == 'setmode' && $permissiontoadd) { + $object->fetch($id); + $result = $object->setPaymentMethods(GETPOSTINT('mode_reglement_id')); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } +} + +// bank account +if ($action == 'setbankaccount' && $permissiontoadd) { + $object->fetch($id); + $result = $object->setBankAccount(GETPOSTINT('fk_account')); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } +} if ($action == "add" && $permissiontoadd) { //var_dump($object);exit; @@ -170,8 +187,10 @@ if ($action == "add" && $permissiontoadd) { $sourcetype = 'salaire'; $newtype = 'salaire'; - $paymentservice = GETPOST('paymentservice'); - $result = $object->demande_prelevement($user, (float) price2num(GETPOST('request_transfer', 'alpha')), $newtype, $sourcetype); + + $paymentservice = GETPOST('paymentservice'); // value can be 'stripesepa'. not used yet. + + $result = $object->demande_prelevement($user, GETPOSTFLOAT('request_transfer'), $newtype, $sourcetype); if ($result > 0) { $db->commit();