diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 4002f437ede28d94c10e46c091d0d638c41272bd..5dba9afda4b3e0f2ed103a28e09c65c374ff834e 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -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; diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 3f827de354089c3430f700726140c1c37dd4c2e9..a42a8ae5890c675827867f6946e7ce465db322b8 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -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) { diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 9349e0e72e03a63104c797af77e0f15173381d92..ccdddfedfea0299d92440c042ee23beb522875bf 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -907,7 +907,6 @@ class ExpenseReport extends CommonObject } } } - if ($this->fk_statut != 2) { $now = dol_now(); @@ -918,7 +917,7 @@ class ExpenseReport extends CommonObject $sql.= ", ref_number_int = ".$ref_number_int; } $sql.= ' WHERE rowid = '.$this->id; - + $resql=$this->db->query($sql); if ($resql) { @@ -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); } } diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 476ef2224f5926b91a2fb0b10a7568879c151667..ead495bc1a0e42650922568a45819ee5494bcc7e 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -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].">";