diff --git a/htdocs/core/lib/expensereport.lib.php b/htdocs/core/lib/expensereport.lib.php
index 0bd2c0f721b..3b54c43af99 100644
--- a/htdocs/core/lib/expensereport.lib.php
+++ b/htdocs/core/lib/expensereport.lib.php
@@ -45,8 +45,12 @@ function expensereport_prepare_head($object)
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'expensereport');
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+ $upload_dir = $conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref);
+ $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
$head[$h][0] = DOL_URL_ROOT.'/expensereport/document.php?id='.$object->id;
- $head[$h][1] = $langs->trans("Documents");
+ $head[$h][1] = $langs->trans('Documents');
+ if($nbFiles > 0) $head[$h][1].= ' '.$nbFiles.'';
$head[$h][2] = 'documents';
$h++;
diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php
index 7bc9a51c022..e11e801a77b 100644
--- a/htdocs/core/modules/modProjet.class.php
+++ b/htdocs/core/modules/modProjet.class.php
@@ -292,11 +292,9 @@ class modProjet extends DolibarrModules
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet_extrafields as extra ON p.rowid = extra.fk_object';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task as pt ON p.rowid = pt.fk_projet";
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet_task_extrafields as extra2 ON pt.rowid = extra2.fk_object';
- $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task_time as ptt ON pt.rowid = ptt.fk_task,";
- $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'societe as s';
- $this->export_sql_end[$r] .=' WHERE p.fk_soc = s.rowid';
- $this->export_sql_end[$r] .=' AND p.entity IN ('.getEntity('project',1).')';
-
+ $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task_time as ptt ON pt.rowid = ptt.fk_task";
+ $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON p.fk_soc = s.rowid';
+ $this->export_sql_end[$r] .=' WHERE p.entity = '.$conf->entity;
}
diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php
index fad813a570b..b66ff15494b 100755
--- a/htdocs/expensereport/card.php
+++ b/htdocs/expensereport/card.php
@@ -2,6 +2,7 @@
/* Copyright (C) 2003 Rodolphe Quiedeville
* Copyright (C) 2004-2008 Laurent Destailleur
* Copyright (C) 2005-2009 Regis Houssin
+ * Copyright (C) 2015 Alexandre Spangaro
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -164,7 +165,7 @@ if ($action == 'update' && $user->rights->expensereport->creer)
$result = $object->update($user);
if ($result > 0)
{
- header("Location: ".$_SEVER["PHP_SELF"]."?id=".$_POST['id']);
+ header("Location: ".$_SERVER["PHP_SELF"]."?id=".$_POST['id']);
exit;
}
else
@@ -217,7 +218,7 @@ if ($action == "confirm_save" && GETPOST("confirm") == "yes" && $id > 0 && $user
$subject = $langs->trans("ExpenseReportWaitingForApproval");
// CONTENT
- $link = $urlwithroot.'/expenserecord/card.php?id='.$object->id;
+ $link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
$message = $langs->trans("ExpenseReportWaitingForApprovalMessage", $expediteur->getFullName($langs), get_date_range($object->date_debut,$object->date_fin,'',$langs), $link);
// Rebuild pdf
@@ -244,7 +245,7 @@ if ($action == "confirm_save" && GETPOST("confirm") == "yes" && $id > 0 && $user
{
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($emailFrom,2),$mailfile->getValidAddress($emailTo,2));
setEventMessage($mesg);
- header("Location: ".$_SEVER["PHP_SELF"]."?id=".$id);
+ header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit;
}
else
@@ -349,7 +350,7 @@ if ($action == "confirm_save_from_refuse" && GETPOST("confirm") == "yes" && $id
// SEND
$result=$mailfile->sendfile();
if ($result):
- Header("Location: ".$_SEVER["PHP_SELF"]."?id=".$id);
+ Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit;
endif;
@@ -454,7 +455,7 @@ if ($action == "confirm_approve" && GETPOST("confirm") == "yes" && $id > 0 && $u
$result=$mailfile->sendfile();
if ($result):
setEventMessage($langs->trans("MailSuccessfulySent",$emailFrom,$emailTo));
- Header("Location: ".$_SEVER["PHP_SELF"]."?id=".$id);
+ Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit;
else:
setEventMessage($langs->trans("ErrorFailedToSendMail",$emailFrom,$emailTo),'errors');
@@ -540,7 +541,7 @@ if ($action == "confirm_refuse" && GETPOST('confirm')=="yes" && $id > 0 && $user
if ($result)
{
setEventMessage($langs->trans("MailSuccessfulySent",$emailFrom,$emailTo));
- Header("Location: ".$_SEVER["PHP_SELF"]."?id=".$id);
+ Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit;
}
else
@@ -624,7 +625,7 @@ if ($action == "confirm_cancel" && GETPOST('confirm')=="yes" && GETPOST('detail_
$result=$mailfile->sendfile();
if ($result)
{
- header("Location: ".$_SEVER["PHP_SELF"]."?id=".$id);
+ header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit;
}
else
@@ -793,7 +794,7 @@ if ($action == "confirm_brouillonner" && GETPOST('confirm')=="yes" && $id > 0 &&
if ($result > 0)
{
- header("Location: ".$_SEVER["PHP_SELF"]."?id=".$id);
+ header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit;
}
else
@@ -1324,27 +1325,27 @@ else
dol_fiche_head($head, 'card', $langs->trans("TripCard"), 0, 'trip');
if ($action == 'save'):
- $ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_save","","",1);
+ $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_save","","",1);
if ($ret == 'html') print '
';
endif;
if ($action == 'save_from_refuse'):
- $ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_save_from_refuse","","",1);
+ $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_save_from_refuse","","",1);
if ($ret == 'html') print '
';
endif;
if ($action == 'delete'):
- $ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteTrip"),$langs->trans("ConfirmDeleteTrip"),"confirm_delete","","",1);
+ $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteTrip"),$langs->trans("ConfirmDeleteTrip"),"confirm_delete","","",1);
if ($ret == 'html') print '
';
endif;
if ($action == 'validate'):
- $ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("ValideTrip"),$langs->trans("ConfirmValideTrip"),"confirm_approve","","",1);
+ $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("ValideTrip"),$langs->trans("ConfirmValideTrip"),"confirm_approve","","",1);
if ($ret == 'html') print '
';
endif;
if ($action == 'paid'):
- $ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("PaidTrip"),$langs->trans("ConfirmPaidTrip"),"confirm_paid","","",1);
+ $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("PaidTrip"),$langs->trans("ConfirmPaidTrip"),"confirm_paid","","",1);
if ($ret == 'html') print '
';
endif;
@@ -1356,20 +1357,20 @@ else
}
if ($action == 'brouillonner'):
- $ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("BrouillonnerTrip"),$langs->trans("ConfirmBrouillonnerTrip"),"confirm_brouillonner","","",1);
+ $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("BrouillonnerTrip"),$langs->trans("ConfirmBrouillonnerTrip"),"confirm_brouillonner","","",1);
if ($ret == 'html') print '
';
endif;
if ($action == 'refuse') // Deny
{
$array_input = array('text'=>$langs->trans("ConfirmRefuseTrip"), array('type'=>"text",'label'=>$langs->trans("Comment"),'name'=>"detail_refuse",'size'=>"50",'value'=>""));
- $ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("Deny"),'',"confirm_refuse",$array_input,"yes",1);
+ $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("Deny"),'',"confirm_refuse",$array_input,"yes",1);
if ($ret == 'html') print '
';
}
if ($action == 'delete_line')
{
- $ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id."&rowid=".$_GET['rowid'],$langs->trans("DeleteLine"),$langs->trans("ConfirmDeleteLine"),"confirm_delete_line",'','yes',1);
+ $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id."&rowid=".$_GET['rowid'],$langs->trans("DeleteLine"),$langs->trans("ConfirmDeleteLine"),"confirm_delete_line",'','yes',1);
if ($ret == 'html') print '
';
}
@@ -1805,18 +1806,18 @@ if ($action != 'create' && $action != 'edit')
if ($object->fk_user_author == $user->id)
{
// Modifier
- print ''.$langs->trans('ModifyInfoGen').'';
+ print ''.$langs->trans('Modify').'';
// Validate
if (count($object->lines) > 0 || count($object->lignes) > 0)
{
- print ''.$langs->trans('ValidateAndSubmit').'';
+ print ''.$langs->trans('ValidateAndSubmit').'';
}
if ($user->rights->expensereport->supprimer)
{
// Supprimer
- print ''.$langs->trans('Delete').'';
+ print ''.$langs->trans('Delete').'';
}
}
}
@@ -1831,12 +1832,12 @@ if ($action != 'create' && $action != 'edit')
if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid)
{
// Modifier
- print ''.$langs->trans('ModifyInfoGen').'';
+ print ''.$langs->trans('Modify').'';
// Brouillonner (le statut refusée est identique à brouillon)
//print ''.$langs->trans('BROUILLONNER').'';
// Enregistrer depuis le statut "Refusée"
- print ''.$langs->trans('ValidateAndSubmit').'';
+ print ''.$langs->trans('ValidateAndSubmit').'';
if ($user->rights->expensereport->supprimer)
{