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;
}
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->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
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;

View File

@@ -1515,17 +1515,17 @@ else
// Validation date
print '<tr>';
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 == 5 && $object->hasDelay('topay')) print ' '.img_warning($langs->trans("Late"));
print '</td></tr>';
print '</tr>';
// User to inform
// User to inform for approval
if ($object->fk_statut < 3) // informed
{
print '<tr>';
print '<td>'.$langs->trans("VALIDATOR").'</td>';
print '<td>'.$langs->trans("VALIDATOR").'</td>'; // approver
print '<td>';
if ($object->fk_user_validator > 0)
{

View File

@@ -907,7 +907,6 @@ class ExpenseReport extends CommonObject
}
}
}
if ($this->fk_statut != 2)
{
$now = dol_now();
@@ -1598,13 +1597,13 @@ class ExpenseReport extends CommonObject
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++;
}
}
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++;
}
}
@@ -1635,11 +1634,12 @@ class ExpenseReport extends CommonObject
if ($option == 'topay' && $this->status != 5) return false;
$now = dol_now();
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
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
if(!empty($search_ref)){
$sql.= " AND d.ref LIKE '%".$db->escape($search_ref)."%'";
$sql.= natural_search("d.ref", $search_ref);
}
// Date Start
if ($month_start > 0)
@@ -325,9 +325,9 @@ if ($resql)
$expensereportstatic->id=$objp->rowid;
$expensereportstatic->ref=$objp->ref;
$expensereportstatic->status=$objp->status;
$expensereportstatic->valid=$objp->date_valid;
$expensereportstatic->date_debut=$objp->date_debut;
$expensereportstatic->date_fin=$objp->date_fin;
$expensereportstatic->date_valid=$db->jdate($objp->date_valid);
$expensereportstatic->date_debut=$db->jdate($objp->date_debut);
$expensereportstatic->date_fin=$db->jdate($objp->date_fin);
$var=!$var;
print "<tr ".$bc[$var].">";