diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 3944e3283f2..8357653f038 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -1,12 +1,12 @@ - * Copyright (C) 2014-2020 Laurent Destailleur - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2015 Charlie BENKE - * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2023 Maxime Nicolas - * Copyright (C) 2023 Benjamin GREMBI +/* Copyright (C) 2011-2024 Alexandre Spangaro + * Copyright (C) 2014-2020 Laurent Destailleur + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Charlie BENKE + * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2023 Maxime Nicolas + * Copyright (C) 2023 Benjamin GREMBI * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -1115,28 +1115,30 @@ if ($id > 0) { } // Reopen - if ($object->paye && $permissiontoadd) { + if ($object->status == $object::STATUS_PAID && $permissiontoadd) { print dolGetButtonAction('', $langs->trans('ReOpen'), 'default', $_SERVER["PHP_SELF"].'?action=reopen&token='.newToken().'&id='.$object->id, ''); } // Edit - if ($object->paye == 0 && $permissiontoadd) { + if ($object->status == $object::STATUS_UNPAID && $permissiontoadd) { print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id, ''); } // Emit payment - if ($object->paye == 0 && ((price2num($object->amount) < 0 && $resteapayer < 0) || (price2num($object->amount) > 0 && $resteapayer > 0)) && $permissiontoadd) { + if ($object->status == $object::STATUS_UNPAID && ((price2num($object->amount) < 0 && $resteapayer < 0) || (price2num($object->amount) > 0 && $resteapayer > 0)) && $permissiontoadd) { print dolGetButtonAction('', $langs->trans('DoPayment'), 'default', DOL_URL_ROOT.'/salaries/paiement_salary.php?action=create&token='.newToken().'&id='. $object->id, ''); } // Classify 'paid' // If payment complete $resteapayer <= 0 on a positive salary, or if amount is negative, we allow to classify as paid. - if ($object->paye == 0 && (($resteapayer <= 0 && $object->amount > 0) || ($object->amount <= 0)) && $permissiontoadd) { + if ($object->status == $object::STATUS_UNPAID && (($resteapayer <= 0 && $object->amount > 0) || ($object->amount <= 0)) && $permissiontoadd) { print dolGetButtonAction('', $langs->trans('ClassifyPaid'), 'default', $_SERVER["PHP_SELF"].'?action=paid&token='.newToken().'&id='.$object->id, ''); } // Transfer request - print dolGetButtonAction('', $langs->trans('MakeTransferRequest'), 'default', DOL_URL_ROOT.'/salaries/virement_request.php?id='.$object->id, ''); + if ($object->status == $object::STATUS_UNPAID && ((price2num($object->amount) < 0 && $resteapayer < 0) || (price2num($object->amount) > 0 && $resteapayer > 0)) && $permissiontoadd) { + print dolGetButtonAction('', $langs->trans('MakeTransferRequest'), 'default', DOL_URL_ROOT . '/salaries/virement_request.php?id=' . $object->id, ''); + } // Clone if ($permissiontoadd) { @@ -1196,7 +1198,7 @@ if ($id > 0) { print ''; } - //Select mail models is same action as presend + // Select mail models is same action as presend if (GETPOST('modelselected')) { $action = 'presend'; }