Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use constant #31410

Merged
merged 14 commits into from
Oct 30, 2024
20 changes: 10 additions & 10 deletions htdocs/expensereport/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright (C) 2015-2023 Alexandre Spangaro <[email protected]>
* Copyright (C) 2017 Ferran Marcet <[email protected]>
* Copyright (C) 2018-2024 Frédéric France <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
*
* 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
Expand Down Expand Up @@ -142,7 +142,7 @@
if ($user->hasRight('expensereport', 'supprimer')) {
$candelete = 1;
}
if ($object->statut == ExpenseReport::STATUS_DRAFT && $user->hasRight('expensereport', 'write') && in_array($object->fk_user_author, $childids)) {
if ($object->status == ExpenseReport::STATUS_DRAFT && $user->hasRight('expensereport', 'write') && in_array($object->fk_user_author, $childids)) {
$candelete = 1;
}

Expand Down Expand Up @@ -1567,15 +1567,15 @@

$head = expensereport_prepare_head($object);

if ($action == 'edit' && ($object->status < 3 || $object->status == 99)) {
if ($action == 'edit' && ($object->status < 3 || $object->status == ExpenseReport::STATUS_REFUSED)) {
print "<form name='update' action=\"".$_SERVER['PHP_SELF']."\" method=\"post\">\n";
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';

print dol_get_fiche_head($head, 'card', $langs->trans("ExpenseReport"), 0, 'trip');

if ($object->status == 99) {
if ($object->status == ExpenseReport::STATUS_REFUSED) {
print '<input type="hidden" name="action" value="updateFromRefuse">';
} else {
print '<input type="hidden" name="action" value="update">';
Expand Down Expand Up @@ -1641,7 +1641,7 @@
print '</td></tr>';
}

if ($object->status == 6) {
if ($object->status == ExpenseReport::STATUS_CLOSED) {
print '<tr>';
print '<td>'.$langs->trans("AUTHORPAIEMENT").'</td>';
print '<td>';
Expand Down Expand Up @@ -1781,10 +1781,10 @@
print '<tr>';
print '<td>'.$langs->trans("DATE_SAVE").'</td>';
print '<td>'.dol_print_date($object->date_valid, 'dayhour', 'tzuser');
if ($object->status == 2 && $object->hasDelay('toapprove')) {
if ($object->status == ExpenseReport::STATUS_VALIDATED && $object->hasDelay('toapprove')) {
print ' '.img_warning($langs->trans("Late").' - '.$langs->trans("ToApprove"));
}
if ($object->status == 5 && $object->hasDelay('topay')) {
if ($object->status == ExpenseReport::STATUS_APPROVED && $object->hasDelay('topay')) {
print ' '.img_warning($langs->trans("Late").' - '.$langs->trans("ToPay"));
}
print '</td></tr>';
Expand Down Expand Up @@ -1847,7 +1847,7 @@
print '</tr>';
}

if ($object->status == 99 || !empty($object->detail_refuse)) {
if ($object->status == ExpenseReport::STATUS_REFUSED || !empty($object->detail_refuse)) {
print '<tr>';
print '<td>'.$langs->trans("REFUSEUR").'</td>';
print '<td>';
Expand Down Expand Up @@ -2051,7 +2051,7 @@
print '<div style="clear: both;"></div>';

$actiontouse = 'updateline';
if (($object->status == 0 || $object->status == 99) && $action != 'editline') {
if (($object->status == ExpenseReport::STATUS_DRAFT || $object->status == ExpenseReport::STATUS_REFUSED) && $action != 'editline') {
$actiontouse = 'addline';
}

Expand Down Expand Up @@ -2099,7 +2099,7 @@
print '</td>';

// Ajout des boutons de modification/suppression
if (($object->status < 2 || $object->status == 99) && $user->hasRight('expensereport', 'creer')) {
if (($object->status < ExpenseReport::STATUS_VALIDATED || $object->status == ExpenseReport::STATUS_REFUSED) && $user->hasRight('expensereport', 'creer')) {
print '<td class="right"></td>';
}
print '</tr>';
Expand Down
Loading