Fix nb of lat approvals wrong

This commit is contained in:
Laurent Destailleur
2016-12-22 15:49:06 +01:00
parent 3f5d67d4d6
commit b4ed0a1e12
4 changed files with 17 additions and 14 deletions

View File

@@ -543,10 +543,13 @@ class Conf
$this->bank->cheque->warning_delay=(isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT)?$this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT:0)*24*60*60; $this->bank->cheque->warning_delay=(isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT)?$this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT:0)*24*60*60;
} }
if (isset($this->expensereport)) { if (isset($this->expensereport)) {
$this->expensereport->approve = new stdClass();
$this->expensereport->approve->warning_delay=(isset($this->global->MAIN_DELAY_EXPENSEREPORTS)?$this->global->MAIN_DELAY_EXPENSEREPORTS:0)*24*60*60;
$this->expensereport->payment = new stdClass(); $this->expensereport->payment = new stdClass();
$this->expensereport->payment->warning_delay=(isset($this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY)?$this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY:0)*24*60*60; $this->expensereport->payment->warning_delay=(isset($this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY)?$this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY:0)*24*60*60;
} }
// For modules that want to disable top or left menu // For modules that want to disable top or left menu
if (! empty($this->global->MAIN_HIDE_TOP_MENU)) $this->dol_hide_topmenu=$this->global->MAIN_HIDE_TOP_MENU; if (! empty($this->global->MAIN_HIDE_TOP_MENU)) $this->dol_hide_topmenu=$this->global->MAIN_HIDE_TOP_MENU;
if (! empty($this->global->MAIN_HIDE_LEFT_MENU)) $this->dol_hide_leftmenu=$this->global->MAIN_HIDE_LEFT_MENU; if (! empty($this->global->MAIN_HIDE_LEFT_MENU)) $this->dol_hide_leftmenu=$this->global->MAIN_HIDE_LEFT_MENU;

View File

@@ -1515,17 +1515,17 @@ else
// Validation date // Validation date
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("DATE_SAVE").'</td>'; print '<td>'.$langs->trans("DATE_SAVE").'</td>';
print '<td>'.dol_print_date($object->date_create,'dayhour'); print '<td>'.dol_print_date($object->date_valid,'dayhour');
if ($object->status == 2 && $object->hasDelay('toapprove')) print ' '.img_warning($langs->trans("Late")); if ($object->status == 2 && $object->hasDelay('toapprove')) print ' '.img_warning($langs->trans("Late"));
if ($object->status == 5 && $object->hasDelay('topay')) print ' '.img_warning($langs->trans("Late")); if ($object->status == 5 && $object->hasDelay('topay')) print ' '.img_warning($langs->trans("Late"));
print '</td></tr>'; print '</td></tr>';
print '</tr>'; print '</tr>';
// User to inform // User to inform for approval
if ($object->fk_statut < 3) // informed if ($object->fk_statut < 3) // informed
{ {
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("VALIDATOR").'</td>'; print '<td>'.$langs->trans("VALIDATOR").'</td>'; // approver
print '<td>'; print '<td>';
if ($object->fk_user_validator > 0) if ($object->fk_user_validator > 0)
{ {

View File

@@ -907,7 +907,6 @@ class ExpenseReport extends CommonObject
} }
} }
} }
if ($this->fk_statut != 2) if ($this->fk_statut != 2)
{ {
$now = dol_now(); $now = dol_now();
@@ -1598,13 +1597,13 @@ class ExpenseReport extends CommonObject
if ($option == 'toapprove') if ($option == 'toapprove')
{ {
if ($this->db->jdate($obj->datevalid) < ($now - $conf->expensereport->approve->warning_delay)) { if ($this->db->jdate($obj->date_valid) < ($now - $conf->expensereport->approve->warning_delay)) {
$response->nbtodolate++; $response->nbtodolate++;
} }
} }
else else
{ {
if ($this->db->jdate($obj->datevalid) < ($now - $conf->expensereport->payment->warning_delay)) { if ($this->db->jdate($obj->date_valid) < ($now - $conf->expensereport->payment->warning_delay)) {
$response->nbtodolate++; $response->nbtodolate++;
} }
} }
@@ -1635,11 +1634,12 @@ class ExpenseReport extends CommonObject
if ($option == 'topay' && $this->status != 5) return false; if ($option == 'topay' && $this->status != 5) return false;
$now = dol_now(); $now = dol_now();
if ($option == 'toapprove') if ($option == 'toapprove')
return $this->datevalid < ($now - $conf->expensereport->approve->warning_delay); {
return ($this->datevalid?$this->datevalid:$this->date_valid) < ($now - $conf->expensereport->approve->warning_delay);
}
else else
return $this->datevalid < ($now - $conf->expensereport->payment->warning_delay); return ($this->datevalid?$this->datevalid:$this->date_valid) < ($now - $conf->expensereport->payment->warning_delay);
} }
} }

View File

@@ -141,7 +141,7 @@ if (!empty($sall))
} }
// Ref // Ref
if(!empty($search_ref)){ if(!empty($search_ref)){
$sql.= " AND d.ref LIKE '%".$db->escape($search_ref)."%'"; $sql.= natural_search("d.ref", $search_ref);
} }
// Date Start // Date Start
if ($month_start > 0) if ($month_start > 0)
@@ -325,9 +325,9 @@ if ($resql)
$expensereportstatic->id=$objp->rowid; $expensereportstatic->id=$objp->rowid;
$expensereportstatic->ref=$objp->ref; $expensereportstatic->ref=$objp->ref;
$expensereportstatic->status=$objp->status; $expensereportstatic->status=$objp->status;
$expensereportstatic->valid=$objp->date_valid; $expensereportstatic->date_valid=$db->jdate($objp->date_valid);
$expensereportstatic->date_debut=$objp->date_debut; $expensereportstatic->date_debut=$db->jdate($objp->date_debut);
$expensereportstatic->date_fin=$objp->date_fin; $expensereportstatic->date_fin=$db->jdate($objp->date_fin);
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";