Fix can refuse expense report

This commit is contained in:
Laurent Destailleur 2015-07-15 15:39:50 +02:00
parent 66fcbeaf8d
commit e571f681a0
3 changed files with 16 additions and 9 deletions

View File

@ -3217,11 +3217,11 @@ class Form
{
foreach ($formquestion as $key => $input)
{
if (isset($input['name'])) array_push($inputok,$input['name']);
//print "xx ".$key." rr ".is_array($input)."<br>\n";
if (is_array($input) && isset($input['name'])) array_push($inputok,$input['name']);
if (isset($input['inputko']) && $input['inputko'] == 1) array_push($inputko,$input['name']);
}
}
// Show JQuery confirm box. Note that global var $useglobalvars is used inside this template
$formconfirm.= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">';
if (! empty($more)) {

View File

@ -576,7 +576,7 @@ if ($action == "confirm_refuse" && GETPOST('confirm')=="yes" && $id > 0 && $user
}
else
{
setEventMessage($object->error, $object->errors);
setEventMessages($object->error, $object->errors, 'errors');
}
}
@ -1407,7 +1407,14 @@ else
print '<tr>';
print '<td>'.$langs->trans("AmountHT").'</td>';
print '<td>'.price($object->total_ht).'</td>';
print '<td rowspan="7" valign="top">';
$rowspan = 5;
if ($object->fk_statut < 3) $rowspan++;
elseif($object->fk_statut == 4) $rowspan+=2;
else $rowspan+=2;
if ($object->fk_statut==99 || !empty($object->detail_refuse)) $rowspan+=2;
if($object->fk_statut==6) $rowspan+=2;
print '<td rowspan="'.$rowspan.'" valign="top">';
/*
* Payments
*/
@ -1501,7 +1508,7 @@ else
print '</tr>';
// User to inform
if($object->fk_statut<3) // informed
if ($object->fk_statut < 3) // informed
{
print '<tr>';
print '<td>'.$langs->trans("VALIDATOR").'</td>';
@ -1515,7 +1522,7 @@ else
}
print '</td></tr>';
}
elseif($object->fk_statut==4)
elseif($object->fk_statut == 4)
{
print '<tr>';
print '<td>'.$langs->trans("CANCEL_USER").'</span></td>';
@ -1554,7 +1561,7 @@ else
print '</tr>';
}
if($object->fk_statut==99 || !empty($object->detail_refuse))
if ($object->fk_statut==99 || !empty($object->detail_refuse))
{
print '<tr>';
print '<td>'.$langs->trans("REFUSEUR").'</td>';

View File

@ -986,8 +986,8 @@ class ExpenseReport extends CommonObject
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql.= " SET ref = '".$this->ref."', fk_statut = 99, fk_user_refuse = ".$fuser->id.",";
$sql.= " date_refuse='".$this->db->idate($now)."',";
$sql.= " detail_refuse='".$this->db->escape($details)."'";
$sql.= " fk_user_approve=NULL,";
$sql.= " detail_refuse='".$this->db->escape($details)."',";
$sql.= " fk_user_approve = NULL";
$sql.= ' WHERE rowid = '.$this->id;
if ($this->db->query($sql))
{