Fix: default value of new expense report is not correctly set
This commit is contained in:
parent
4d6ce2a1de
commit
f48128baf7
@ -222,7 +222,7 @@ if ($action == "confirm_validate" && GETPOST("confirm") == "yes" && $id > 0 && $
|
|||||||
if ($emailTo && $emailFrom)
|
if ($emailTo && $emailFrom)
|
||||||
{
|
{
|
||||||
$filename=array(); $filedir=array(); $mimetype=array();
|
$filename=array(); $filedir=array(); $mimetype=array();
|
||||||
|
|
||||||
// SUBJECT
|
// SUBJECT
|
||||||
$subject = $langs->trans("ExpenseReportWaitingForApproval");
|
$subject = $langs->trans("ExpenseReportWaitingForApproval");
|
||||||
|
|
||||||
@ -716,9 +716,9 @@ if ($action == 'set_paid' && $id > 0 && $user->rights->expensereport->to_paid)
|
|||||||
{
|
{
|
||||||
$object = new ExpenseReport($db);
|
$object = new ExpenseReport($db);
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
|
|
||||||
$result = $object->set_paid($id, $user);
|
$result = $object->set_paid($id, $user);
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
// Define output language
|
// Define output language
|
||||||
@ -777,7 +777,7 @@ if ($action == 'set_paid' && $id > 0 && $user->rights->expensereport->to_paid)
|
|||||||
// SEND
|
// SEND
|
||||||
$result=$mailfile->sendfile();
|
$result=$mailfile->sendfile();
|
||||||
if ($result):
|
if ($result):
|
||||||
|
|
||||||
// Retour
|
// Retour
|
||||||
if($result):
|
if($result):
|
||||||
Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
||||||
@ -785,7 +785,7 @@ if ($action == 'set_paid' && $id > 0 && $user->rights->expensereport->to_paid)
|
|||||||
else:
|
else:
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
else:
|
else:
|
||||||
dol_print_error($db,$acct->error);
|
dol_print_error($db,$acct->error);
|
||||||
endif;
|
endif;
|
||||||
@ -1115,7 +1115,10 @@ if ($action == 'create')
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
$object = new ExpenseReport($db);
|
$object = new ExpenseReport($db);
|
||||||
$include_users = $object->fetch_users_approver_expensereport();
|
$include_users = $object->fetch_users_approver_expensereport();
|
||||||
$s=$form->select_dolusers((GETPOST('fk_user_validator')?GETPOST('fk_user_validator'):$conf->global->EXPENSEREPORT_DEFAULT_VALIDATOR), "fk_user_validator", 1, "", 0, $include_users);
|
$defaultselectuser=$user->fk_user; // Will work only if supervisor has permission to approve so is inside include_users
|
||||||
|
if (! empty($conf->global->EXPENSEREPORT_DEFAULT_VALIDATOR)) $defaultselectuser=$conf->global->EXPENSEREPORT_DEFAULT_VALIDATOR;
|
||||||
|
if (GETPOST('fk_user_validator') > 0) $defaultselectuser=GETPOST('fk_user_validator');
|
||||||
|
$s=$form->select_dolusers($defaultselectuser, "fk_user_validator", 1, "", 0, $include_users);
|
||||||
print $form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate"));
|
print $form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate"));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -1392,7 +1395,7 @@ else
|
|||||||
print '<td>'.$langs->trans("Statut").'</td>';
|
print '<td>'.$langs->trans("Statut").'</td>';
|
||||||
print '<td colspan="2">'.$object->getLibStatut(4).'</td>';
|
print '<td colspan="2">'.$object->getLibStatut(4).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans("NotePublic").'</td>';
|
print '<td>'.$langs->trans("NotePublic").'</td>';
|
||||||
print '<td colspan="2">'.$object->note_public.'</td>';
|
print '<td colspan="2">'.$object->note_public.'</td>';
|
||||||
@ -1468,7 +1471,7 @@ else
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
print "</td>";
|
print "</td>";
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans("AmountVAT").'</td>';
|
print '<td>'.$langs->trans("AmountVAT").'</td>';
|
||||||
@ -1582,7 +1585,7 @@ else
|
|||||||
print '<td>'.$object->date_paiement.'</td></tr>';
|
print '<td>'.$object->date_paiement.'</td></tr>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -1951,7 +1954,7 @@ if ($action != 'create' && $action != 'edit')
|
|||||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$object->id.'">'.$langs->trans('Delete').'</a>';
|
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$object->id.'">'.$langs->trans('Delete').'</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Si l'état est "A payer"
|
/* Si l'état est "A payer"
|
||||||
* ET user à droit de "to_paid"
|
* ET user à droit de "to_paid"
|
||||||
* Afficher : "Annuler" / "Payer" / "Supprimer"
|
* Afficher : "Annuler" / "Payer" / "Supprimer"
|
||||||
@ -1967,7 +1970,7 @@ if ($action != 'create' && $action != 'edit')
|
|||||||
{
|
{
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/expensereport/payment/payment.php?id=' . $object->id . '&action=create">' . $langs->trans('DoPayment') . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/expensereport/payment/payment.php?id=' . $object->id . '&action=create">' . $langs->trans('DoPayment') . '</a></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (round($remaintopay) == 0 && $object->paid == 0)
|
if (round($remaintopay) == 0 && $object->paid == 0)
|
||||||
{
|
{
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id='.$object->id.'&action=set_paid">'.$langs->trans("ClassifyPaid")."</a></div>";
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id='.$object->id.'&action=set_paid">'.$langs->trans("ClassifyPaid")."</a></div>";
|
||||||
@ -1978,7 +1981,7 @@ if ($action != 'create' && $action != 'edit')
|
|||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=cancel&id='.$object->id.'">'.$langs->trans('Cancel').'</a>';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=cancel&id='.$object->id.'">'.$langs->trans('Cancel').'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete
|
// Delete
|
||||||
if($user->rights->expensereport->supprimer)
|
if($user->rights->expensereport->supprimer)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -120,7 +120,7 @@ if ($conf->use_javascript_ajax)
|
|||||||
{
|
{
|
||||||
print '<tr '.$bc[0].'><td align="center" colspan="4">';
|
print '<tr '.$bc[0].'><td align="center" colspan="4">';
|
||||||
$data=array('series'=>$dataseries);
|
$data=array('series'=>$dataseries);
|
||||||
dol_print_graph('stats',320,180,$data,1,'pie',0);
|
dol_print_graph('stats',320,180,$data,1,'pie',0,'',0);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user