Fix: default value of new expense report is not correctly set

This commit is contained in:
Laurent Destailleur 2015-07-15 15:04:44 +02:00
parent 4d6ce2a1de
commit f48128baf7
2 changed files with 16 additions and 13 deletions

View File

@ -222,7 +222,7 @@ if ($action == "confirm_validate" && GETPOST("confirm") == "yes" && $id > 0 && $
if ($emailTo && $emailFrom)
{
$filename=array(); $filedir=array(); $mimetype=array();
// SUBJECT
$subject = $langs->trans("ExpenseReportWaitingForApproval");
@ -716,9 +716,9 @@ if ($action == 'set_paid' && $id > 0 && $user->rights->expensereport->to_paid)
{
$object = new ExpenseReport($db);
$object->fetch($id);
$result = $object->set_paid($id, $user);
if ($result > 0)
{
// Define output language
@ -777,7 +777,7 @@ if ($action == 'set_paid' && $id > 0 && $user->rights->expensereport->to_paid)
// SEND
$result=$mailfile->sendfile();
if ($result):
// Retour
if($result):
Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
@ -785,7 +785,7 @@ if ($action == 'set_paid' && $id > 0 && $user->rights->expensereport->to_paid)
else:
dol_print_error($db);
endif;
else:
dol_print_error($db,$acct->error);
endif;
@ -1115,7 +1115,10 @@ if ($action == 'create')
print '<td>';
$object = new ExpenseReport($db);
$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 '</td>';
print '</tr>';
@ -1392,7 +1395,7 @@ else
print '<td>'.$langs->trans("Statut").'</td>';
print '<td colspan="2">'.$object->getLibStatut(4).'</td>';
print '</tr>';
print '<tr>';
print '<td>'.$langs->trans("NotePublic").'</td>';
print '<td colspan="2">'.$object->note_public.'</td>';
@ -1468,7 +1471,7 @@ else
dol_print_error($db);
}
print "</td>";
print '</tr>';
print '<tr>';
print '<td>'.$langs->trans("AmountVAT").'</td>';
@ -1582,7 +1585,7 @@ else
print '<td>'.$object->date_paiement.'</td></tr>';
print '</tr>';
}
print '</table>';
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>';
}
}
/* Si l'état est "A payer"
* ET user à droit de "to_paid"
* 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 . '&amp;action=create">' . $langs->trans('DoPayment') . '</a></div>';
}
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>";
@ -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>';
}
// Delete
if($user->rights->expensereport->supprimer)
{

View File

@ -120,7 +120,7 @@ if ($conf->use_javascript_ajax)
{
print '<tr '.$bc[0].'><td align="center" colspan="4">';
$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>';
}