Correct fk_statut & work en list
This commit is contained in:
parent
f3258d59c6
commit
69dc3cdd61
@ -2140,7 +2140,7 @@ abstract class CommonObject
|
||||
|
||||
$fieldstatus="fk_statut";
|
||||
if ($elementTable == 'user') $fieldstatus="statut";
|
||||
if ($elementTable == 'expensereport') $fieldstatus="fk_c_expensereport_statuts";
|
||||
if ($elementTable == 'expensereport') $fieldstatus="fk_statut";
|
||||
if ($elementTable == 'commande_fournisseur_dispatch') $fieldstatus="status";
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$elementTable;
|
||||
|
||||
@ -508,7 +508,7 @@ class pdf_standard extends ModeleExpenseReport
|
||||
*/
|
||||
|
||||
// Filligrane brouillon
|
||||
if ($object->fk_c_expensereport_statuts==1 && ! empty($conf->global->EXPENSEREPORT_FREE_TEXT))
|
||||
if ($object->fk_statut==1 && ! empty($conf->global->EXPENSEREPORT_FREE_TEXT))
|
||||
{
|
||||
pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->EXPENSEREPORT_FREE_TEXT);
|
||||
}
|
||||
@ -640,7 +640,7 @@ class pdf_standard extends ModeleExpenseReport
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DateCreation")." : ".dol_print_date($object->date_create,"day",false,$outpulangs),0,'L');
|
||||
}
|
||||
|
||||
if ($object->fk_c_expensereport_statuts==99)
|
||||
if ($object->fk_statut==99)
|
||||
{
|
||||
if ($object->fk_user_refuse > 0)
|
||||
{
|
||||
@ -656,7 +656,7 @@ class pdf_standard extends ModeleExpenseReport
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DATE_REFUS")." : ".dol_print_date($object->date_refuse,"day",false,$outpulangs),0,'L');
|
||||
}
|
||||
}
|
||||
else if($object->fk_c_expensereport_statuts==4)
|
||||
else if($object->fk_statut==4)
|
||||
{
|
||||
if ($object->fk_user_cancel > 0)
|
||||
{
|
||||
@ -686,7 +686,7 @@ class pdf_standard extends ModeleExpenseReport
|
||||
}
|
||||
}
|
||||
|
||||
if($object->fk_c_expensereport_statuts==6)
|
||||
if($object->fk_statut==6)
|
||||
{
|
||||
if ($object->fk_user_paid > 0)
|
||||
{
|
||||
|
||||
@ -270,7 +270,7 @@ class modExpenseReport extends DolibarrModules
|
||||
'titre'=>'ListToApprove',
|
||||
'mainmenu'=>'hrm',
|
||||
'leftmenu'=>'expensereport_detaillist_approve',
|
||||
'url'=>'/expensereport/list.php?search_state=2',
|
||||
'url'=>'/expensereport/list.php?search_status=2',
|
||||
'langs'=>'trips', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>100,
|
||||
'enabled'=>'$conf->expensereport->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
||||
|
||||
@ -1712,17 +1712,17 @@ else
|
||||
|
||||
print '<tr>';
|
||||
|
||||
// Sélection date
|
||||
// Select date
|
||||
print '<td style="text-align:center;">';
|
||||
$form->select_date($date?$date:-1,'date');
|
||||
print '</td>';
|
||||
|
||||
// Sélection projet
|
||||
// Select project
|
||||
print '<td>';
|
||||
$formproject->select_projects(-1, GETPOST('fk_projet'), 'fk_projet', 0, 0, 1, 1);
|
||||
print '</td>';
|
||||
|
||||
// Sélection type
|
||||
// Select type
|
||||
print '<td>';
|
||||
select_type_fees_id(GETPOST('fk_c_type_fees'),'fk_c_type_fees',1);
|
||||
print '</td>';
|
||||
@ -1732,7 +1732,7 @@ else
|
||||
print '<textarea class="flat_ndf centpercent" name="comments">'.GETPOST('comments').'</textarea>';
|
||||
print '</td>';
|
||||
|
||||
// Sélection TVA
|
||||
// Select VAT
|
||||
print '<td style="text-align:right;">';
|
||||
$defaultvat=-1;
|
||||
if (! empty($conf->global->EXPENSEREPORT_NO_DEFAULT_VAT)) $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS = 'none';
|
||||
@ -1747,7 +1747,7 @@ else
|
||||
print '<input type="text" size="6" name="value_unit" value="'.GETPOST('value_unit').'">';
|
||||
print '</td>';
|
||||
|
||||
// Quantité
|
||||
// Quantity
|
||||
print '<td style="text-align:right;">';
|
||||
print '<input type="text" size="4" name="qty" value="'.GETPOST('qty').'">';
|
||||
print '</td>';
|
||||
|
||||
@ -335,7 +335,7 @@ class ExpenseReport extends CommonObject
|
||||
if ($this->fk_user_validator > 0) $user_approver->fetch($this->fk_user_validator);
|
||||
$this->user_validator_infos = dolGetFirstLastname($user_approver->firstname, $user_approver->lastname);
|
||||
|
||||
$this->fk_statut = $obj->status;
|
||||
$this->fk_statut = $obj->status;
|
||||
$this->status = $obj->status;
|
||||
$this->fk_c_paiement = $obj->fk_c_paiement;
|
||||
|
||||
|
||||
@ -21,12 +21,13 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/expensereport/index.php
|
||||
* \brief Page liste des expensereports
|
||||
* \brief list of expense reports
|
||||
*/
|
||||
|
||||
require "../main.inc.php";
|
||||
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("users");
|
||||
@ -39,7 +40,7 @@ $result = restrictedArea($user, 'expensereport','','');
|
||||
|
||||
$search_ref = GETPOST('search_ref');
|
||||
$search_user = GETPOST('search_user','int');
|
||||
$search_state = GETPOST('search_state','int');
|
||||
$search_status = GETPOST('search_status','int');
|
||||
$month_start = GETPOST("month_start","int");
|
||||
$year_start = GETPOST("year_start","int");
|
||||
$month_end = GETPOST("month_end","int");
|
||||
@ -49,7 +50,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
{
|
||||
$search_ref="";
|
||||
$search_user="";
|
||||
$search_state="";
|
||||
$search_status="";
|
||||
$month_start="";
|
||||
$year_start="";
|
||||
$month_end="";
|
||||
@ -69,13 +70,12 @@ llxHeader('', $langs->trans("ListOfTrips"));
|
||||
$max_year = 5;
|
||||
$min_year = 5;
|
||||
|
||||
$sortorder = $_GET["sortorder"];
|
||||
$sortfield = $_GET["sortfield"];
|
||||
$page = $_GET["page"];
|
||||
$sortorder = GETPOST("sortorder");
|
||||
$sortfield = GETPOST("sortfield");
|
||||
$page = GETPOST("page");
|
||||
if (!$sortorder) $sortorder="DESC";
|
||||
if (!$sortfield) $sortfield="d.date_debut";
|
||||
|
||||
|
||||
if ($page == -1) {
|
||||
$page = 0 ;
|
||||
}
|
||||
@ -91,73 +91,47 @@ $sql.= " u.rowid as id_user, u.firstname, u.lastname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d";
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON d.fk_user_author = u.rowid";
|
||||
|
||||
|
||||
|
||||
// WHERE
|
||||
// Where
|
||||
if(!empty($search_ref)){
|
||||
$sql.= " WHERE d.ref LIKE '%".$db->escape($search_ref)."%'";
|
||||
}else{
|
||||
$sql.= " WHERE 1 = 1";
|
||||
}
|
||||
// DATE START
|
||||
if ($month_start > 0) {
|
||||
if ($year_start > 0) {
|
||||
if($month_end > 0) {
|
||||
if($year_end > 0) {
|
||||
$sql.= " AND date_format(d.date_debut, '%Y-%m') >= '$year_start-$month_start'";
|
||||
$sql.= " AND date_format(d.date_fin, '%Y-%m') <= '$year_end-$month_end'";
|
||||
} else {
|
||||
$sql.= " AND date_format(d.date_debut, '%Y-%m') >= '$year_start-$month_start'";
|
||||
$sql.= " AND date_format(d.date_fin, '%m') <= '$month_end'";
|
||||
}
|
||||
} else {
|
||||
if($year_end > 0) {
|
||||
$sql.= " AND date_format(d.date_debut, '%Y-%m') >= '$year_start-$month_start'";
|
||||
$sql.= " AND date_format(d.date_fin, '%Y') <= '$year_end'";
|
||||
} else {
|
||||
$sql.= " AND date_format(d.date_debut, '%Y-%m') >= '$year_start-$month_start'";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$sql.= " AND date_format(d.date_debut, '%m') >= '$month_start'";
|
||||
}
|
||||
} else {
|
||||
if ($year_start > 0) {
|
||||
if($month_end > 0) {
|
||||
if($year_end > 0) {
|
||||
$sql.= " AND date_format(d.date_debut, '%Y') >= '$year_start'";
|
||||
$sql.= " AND date_format(d.date_fin, '%Y-%m') <= '$year_end-$month_end'";
|
||||
} else {
|
||||
$sql.= " AND date_format(d.date_debut, '%Y') >= '$year_start'";
|
||||
$sql.= " AND date_format(d.date_fin, '%m') <= '$month_end'";
|
||||
}
|
||||
} else {
|
||||
if($year_end > 0) {
|
||||
$sql.= " AND date_format(d.date_debut, '%Y') >= '$year_start'";
|
||||
$sql.= " AND date_format(d.date_fin, '%Y') <= '$year_end'";
|
||||
} else {
|
||||
$sql.= " AND date_format(d.date_debut, '%Y') >= '$year_start'";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if($month_end > 0) {
|
||||
if($year_end > 0) {
|
||||
$sql.= " AND date_format(d.date_debut, '%Y') >= '$year_start'";
|
||||
$sql.= " AND date_format(d.date_fin, '%Y-%m') <= '$year_end-$month_end'";
|
||||
} else {
|
||||
$sql.= " AND date_format(d.date_debut, '%Y') >= '$year_start'";
|
||||
$sql.= " AND date_format(d.date_fin, '%m') <= '$month_end'";
|
||||
}
|
||||
} else {
|
||||
if($year_end > 0) {
|
||||
$sql.= " AND date_format(d.date_debut, '%Y') >= '$year_start'";
|
||||
$sql.= " AND date_format(d.date_fin, '%Y') <= '$year_end'";
|
||||
}
|
||||
}
|
||||
}
|
||||
// Date Start
|
||||
if ($month_start > 0)
|
||||
{
|
||||
if ($year_start > 0 && empty($day))
|
||||
$sql.= " AND d.date_debut BETWEEN '".$db->idate(dol_get_first_day($year_start,$month_start,false))."' AND '".$db->idate(dol_get_last_day($year_start,$month_start,false))."'";
|
||||
else if ($year_start > 0 && ! empty($day))
|
||||
$sql.= " AND d.date_debut BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month_start, $day, $year_start))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month_start, $day, $year_start))."'";
|
||||
else
|
||||
$sql.= " AND date_format(d.date_debut, '%m') = '".$month_start."'";
|
||||
}
|
||||
if (!empty($search_user) && $search_user > 0) $sql.= " AND d.fk_user_author = '".$search_user."'";
|
||||
if($search_state != '') $sql.= " AND d.fk_statut = '$search_state'\n";
|
||||
else if ($year_start > 0)
|
||||
{
|
||||
$sql.= " AND d.date_debut BETWEEN '".$db->idate(dol_get_first_day($year_start,1,false))."' AND '".$db->idate(dol_get_last_day($year_start,12,false))."'";
|
||||
}
|
||||
// Date Start
|
||||
if ($month_end > 0)
|
||||
{
|
||||
if ($year_end > 0 && empty($day))
|
||||
$sql.= " AND d.date_fin BETWEEN '".$db->idate(dol_get_first_day($year_end,$month_end,false))."' AND '".$db->idate(dol_get_last_day($year_end,$month_end,false))."'";
|
||||
else if ($year_end > 0 && ! empty($day))
|
||||
$sql.= " AND d.date_fin BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month_end, $day, $year_end))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month_end, $day, $year_end))."'";
|
||||
else
|
||||
$sql.= " AND date_format(d.date_fin, '%m') = '".$month_end."'";
|
||||
}
|
||||
else if ($year_end > 0)
|
||||
{
|
||||
$sql.= " AND d.date_fin BETWEEN '".$db->idate(dol_get_first_day($year_end,1,false))."' AND '".$db->idate(dol_get_last_day($year_end,12,false))."'";
|
||||
}
|
||||
// User
|
||||
if ($search_name)
|
||||
{
|
||||
$sql .= natural_search('u.lastname', $search_name);
|
||||
}
|
||||
// Status
|
||||
if($search_status != '') $sql.= " AND d.fk_statut = '".$search_status."'";
|
||||
|
||||
// RESTRICT RIGHTS
|
||||
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous))
|
||||
@ -219,17 +193,13 @@ if ($resql)
|
||||
print '<td class="liste_titre"> </td>';
|
||||
}
|
||||
|
||||
|
||||
print '<td class="liste_titre"> </td>';
|
||||
|
||||
print '<td class="liste_titre"> </td>';
|
||||
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print "</td>";
|
||||
print '<td class="liste_titre"> </td>';
|
||||
|
||||
// Status
|
||||
print '<td class="liste_titre" align="right">';
|
||||
select_expensereport_statut($search_state,'search_state');
|
||||
select_expensereport_statut($search_status,'search_status');
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre" align="right">';
|
||||
@ -257,10 +227,6 @@ if ($resql)
|
||||
print '<td align="center">'.($objp->date_debut > 0 ? dol_print_date($objp->date_debut, 'day') : '').'</td>';
|
||||
print '<td align="center">'.($objp->date_fin > 0 ? dol_print_date($objp->date_fin, 'day') : '').'</td>';
|
||||
print '<td align="left"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$objp->id_user.'">'.img_object($langs->trans("ShowUser"),"user").' '.dolGetFirstLastname($objp->firstname, $objp->lastname).'</a></td>';
|
||||
/*print '<td align="right">'.price($objp->total_tva, '', $langs, 0, 'MT', 0, $conf->currency).'</td>';
|
||||
print '<td align="right">'.price($objp->total_ht, '', $langs, 0, 'MT', 0, $conf->currency).'</td>';
|
||||
print '<td align="right">'.price($objp->total_ttc, '', $langs, 0, 'MT', 0, $conf->currency).'</td>';
|
||||
*/
|
||||
print '<td align="right">'.price($objp->total_ht).'</td>';
|
||||
print '<td align="right">'.price($objp->total_tva).'</td>';
|
||||
print '<td align="right">'.price($objp->total_ttc).'</td>';
|
||||
@ -281,11 +247,7 @@ if ($resql)
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="4">'.$langs->trans("Total").'</td>';
|
||||
/*
|
||||
print '<td style="text-align:right;">'.price($total_total_tva, '', $langs, 0, 'MT', 0, $conf->currency).'</td>';
|
||||
print '<td style="text-align:right;">'.price($total_total_ht, '', $langs, 0, 'MT', 0, $conf->currency).'</td>';
|
||||
print '<td style="text-align:right;">'.price($total_total_ttc, '', $langs, 0, 'MT', 0, $conf->currency).'</td>';
|
||||
*/
|
||||
|
||||
print '<td style="text-align:right;">'.$total_total_ht.'</td>';
|
||||
print '<td style="text-align:right;">'.$total_total_tva.'</td>';
|
||||
print '<td style="text-align:right;">'.$total_total_ttc.'</td>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user