Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
826c4de2
Commit
826c4de2
authored
9 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Uniformize and debug module expense report.
parent
88e76dcf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
htdocs/expensereport/card.php
+78
-58
78 additions, 58 deletions
htdocs/expensereport/card.php
htdocs/expensereport/class/expensereport.class.php
+5
-2
5 additions, 2 deletions
htdocs/expensereport/class/expensereport.class.php
htdocs/expensereport/list.php
+2
-2
2 additions, 2 deletions
htdocs/expensereport/list.php
with
85 additions
and
62 deletions
htdocs/expensereport/card.php
+
78
−
58
View file @
826c4de2
...
...
@@ -51,6 +51,8 @@ $date = dol_mktime(0, 0, 0, GETPOST('datemonth'), GETPOST('dateday'), GETPOST('d
$fk_projet
=
GETPOST
(
'fk_projet'
);
$vatrate
=
GETPOST
(
'vatrate'
);
$ref
=
GETPOST
(
"ref"
,
'alpha'
);
$comments
=
GETPOST
(
'comments'
);
$fk_c_type_fees
=
GETPOST
(
'fk_c_type_fees'
,
'int'
);
// If socid provided by ajax company selector
if
(
!
empty
(
$_REQUEST
[
'socid_id'
]))
...
...
@@ -92,7 +94,19 @@ $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($co
* Actions
*/
if
(
$cancel
)
$action
=
''
;
if
(
$cancel
)
{
$action
=
''
;
$fk_projet
=
''
;
$date_start
=
''
;
$date_end
=
''
;
$date
=
''
;
$comments
=
''
;
$vatrate
=
''
;
$value_unit
=
''
;
$qty
=
1
;
$fk_c_type_fees
=-
1
;
}
if
(
$action
==
'confirm_delete'
&&
GETPOST
(
"confirm"
)
==
"yes"
&&
$id
>
0
&&
$user
->
rights
->
expensereport
->
supprimer
)
{
...
...
@@ -863,7 +877,7 @@ if ($action == "addline")
if
(
$object_ligne
->
value_unit
==
0
)
{
$error
++
;
setEventMessages
(
$langs
->
trans
(
"ErrorFieldRequired"
,
$langs
->
transnoentitiesnoconv
(
"
U
P"
)),
null
,
'errors'
);
setEventMessages
(
$langs
->
trans
(
"ErrorFieldRequired"
,
$langs
->
transnoentitiesnoconv
(
"P
riceUTTC
"
)),
null
,
'errors'
);
}
// S'il y'a eu au moins une erreur
...
...
@@ -1615,7 +1629,19 @@ else
$sql
.
=
' LEFT JOIN '
.
MAIN_DB_PREFIX
.
'projet as pjt ON fde.fk_projet=pjt.rowid'
;
$sql
.
=
' WHERE fde.fk_expensereport = '
.
$object
->
id
;
$resql
=
$db
->
query
(
$sql
);
print
'<div style="clear: both;">'
;
$actiontouse
=
'updateligne'
;
if
((
$object
->
fk_statut
==
0
||
$object
->
fk_statut
==
99
)
&&
$action
!=
'editline'
)
$actiontouse
=
'addline'
;
print
'<form name="expensereport" action="'
.
$_SERVER
[
"PHP_SELF"
]
.
'" method="post">'
;
print
'<input type="hidden" name="token" value="'
.
$_SESSION
[
'newtoken'
]
.
'">'
;
print
'<input type="hidden" name="action" value="'
.
$actiontouse
.
'">'
;
print
'<input type="hidden" name="id" value="'
.
$object
->
id
.
'">'
;
print
'<input type="hidden" name="fk_expensereport" value="'
.
$object
->
id
.
'" />'
;
print
'<table class="noborder" width="100%">'
;
$resql
=
$db
->
query
(
$sql
);
if
(
$resql
)
{
$num_lignes
=
$db
->
num_rows
(
$resql
);
...
...
@@ -1623,34 +1649,21 @@ else
if
(
$num_lignes
)
{
print
'<div style="clear: both;">'
;
print
'<form name="updateligne" action="'
.
$_SERVER
[
"PHP_SELF"
]
.
'" method="post">'
;
print
'<input type="hidden" name="token" value="'
.
$_SESSION
[
'newtoken'
]
.
'">'
;
print
'<input type="hidden" name="action" value="updateligne">'
;
print
'<input type="hidden" name="id" value="'
.
$object
->
id
.
'">'
;
print
'<table class="noborder" width="100%">'
;
print
'<tr class="liste_titre">'
;
if
(
$action
!=
'editline'
)
print
'<td style="text-align:center;">'
.
$langs
->
trans
(
'Piece'
)
.
'</td>'
;
print
'<td style="text-align:center;">'
.
$langs
->
trans
(
'Piece'
)
.
'</td>'
;
print
'<td style="text-align:center;">'
.
$langs
->
trans
(
'Date'
)
.
'</td>'
;
print
'<td
style="text-align:center;"
>'
.
$langs
->
trans
(
'Project'
)
.
'</td>'
;
print
'<td>'
.
$langs
->
trans
(
'Project'
)
.
'</td>'
;
print
'<td style="text-align:center;">'
.
$langs
->
trans
(
'Type'
)
.
'</td>'
;
print
'<td style="text-align:left;">'
.
$langs
->
trans
(
'Description'
)
.
'</td>'
;
print
'<td style="text-align:right;">'
.
$langs
->
trans
(
'VAT'
)
.
'</td>'
;
print
'<td style="text-align:right;">'
.
$langs
->
trans
(
'
Unit
PriceTTC'
)
.
'</td>'
;
print
'<td style="text-align:right;">'
.
$langs
->
trans
(
'Price
U
TTC'
)
.
'</td>'
;
print
'<td style="text-align:right;">'
.
$langs
->
trans
(
'Qty'
)
.
'</td>'
;
if
(
$action
!=
'editline'
)
{
print
'<td style="text-align:right;">'
.
$langs
->
trans
(
'AmountHT'
)
.
'</td>'
;
print
'<td style="text-align:right;">'
.
$langs
->
trans
(
'AmountTTC'
)
.
'</td>'
;
}
// Ajout des boutons de modification/suppression
if
(
$object
->
fk_statut
<
2
||
$object
->
fk_statut
==
99
)
{
print
'<td style="text-align:right;"></td>'
;
}
print
'<td style="text-align:right;"></td>'
;
print
'</tr>'
;
...
...
@@ -1663,14 +1676,11 @@ else
if
(
$action
!=
'editline'
||
$objp
->
rowid
!=
GETPOST
(
'rowid'
))
{
print
'<tr '
.
$bc
[
$var
]
.
'>'
;
if
(
$action
!=
'editline'
)
{
print
'<td style="text-align:center;">'
;
print
img_picto
(
$langs
->
trans
(
"Document"
),
"object_generic"
);
print
' <span>'
.
$piece_comptable
.
'</span></td>'
;
}
print
'<td style="text-align:center;">'
.
dol_print_date
(
$db
->
jdate
(
$objp
->
date
),
'day'
)
.
'</td>'
;
print
'<td style="text-align:center;">'
;
print
img_picto
(
$langs
->
trans
(
"Document"
),
"object_generic"
);
print
' <span>'
.
$piece_comptable
.
'</span></td>'
;
print
'<td style="text-align:center;">'
.
dol_print_date
(
$db
->
jdate
(
$objp
->
date
),
'day'
)
.
'</td>'
;
print
'<td>'
;
if
(
$objp
->
projet_id
>
0
)
{
$projecttmp
->
id
=
$objp
->
projet_id
;
...
...
@@ -1683,6 +1693,7 @@ else
print
'<td style="text-align:right;">'
.
vatrate
(
$objp
->
vatrate
,
true
)
.
'</td>'
;
print
'<td style="text-align:right;">'
.
price
(
$objp
->
value_unit
)
.
'</td>'
;
print
'<td style="text-align:right;">'
.
$objp
->
qty
.
'</td>'
;
if
(
$action
!=
'editline'
)
{
print
'<td style="text-align:right;">'
.
price
(
$objp
->
total_ht
)
.
'</td>'
;
...
...
@@ -1690,17 +1701,18 @@ else
}
// Ajout des boutons de modification/suppression
print
'<td style="text-align:right;" class="nowrap">'
;
if
(
$object
->
fk_statut
<
2
OR
$object
->
fk_statut
==
99
)
{
print
'<td style="text-align:right;" class="nowrap">'
;
print
'<a href="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?id='
.
$object
->
id
.
'&action=editline&rowid='
.
$objp
->
rowid
.
'#'
.
$objp
->
rowid
.
'">'
;
print
img_edit
();
print
'</a> '
;
print
'<a href="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?id='
.
$object
->
id
.
'&action=delete_line&rowid='
.
$objp
->
rowid
.
'">'
;
print
img_delete
();
print
'</a>'
;
print
'</td>'
;
}
print
'</td>'
;
print
'</tr>'
;
}
...
...
@@ -1708,6 +1720,9 @@ else
{
//modif ligne!!!!!
print
'<tr '
.
$bc
[
$var
]
.
'>'
;
print
'<td></td>'
;
// Select date
print
'<td style="text-align:center;">'
;
$form
->
select_date
(
$objp
->
date
,
'date'
);
...
...
@@ -1743,6 +1758,12 @@ else
print
'<input type="text" size="4" name="qty" value="'
.
$objp
->
qty
.
'" />'
;
print
'</td>'
;
if
(
$action
!=
'editline'
)
{
print
'<td style="text-align:right;">'
.
$langs
->
trans
(
'AmountHT'
)
.
'</td>'
;
print
'<td style="text-align:right;">'
.
$langs
->
trans
(
'AmountTTC'
)
.
'</td>'
;
}
print
'<td style="text-align:center;">'
;
print
'<input type="hidden" name="rowid" value="'
.
$objp
->
rowid
.
'">'
;
print
'<input type="submit" class="button" name="save" value="'
.
$langs
->
trans
(
'Save'
)
.
'">'
;
...
...
@@ -1754,12 +1775,6 @@ else
}
$db
->
free
(
$resql
);
print
'</table>'
;
print
'</form>'
;
print
'</div>'
;
}
else
{
...
...
@@ -1772,27 +1787,23 @@ else
// Add a line
if
((
$object
->
fk_statut
==
0
||
$object
->
fk_statut
==
99
)
&&
$action
!=
'editline'
)
{
print
load_fiche_titre
(
$langs
->
trans
(
"AddLine"
),
''
,
''
);
print
'<form method="post" action="'
.
$_SERVER
[
'PHP_SELF'
]
.
'" name="addline">'
;
print
'<input type="hidden" name="id" value="'
.
$object
->
id
.
'">'
;
print
'<input type="hidden" name="fk_expensereport" value="'
.
$object
->
id
.
'" />'
;
print
'<input type="hidden" name="action" value="addline" />'
;
print
'<table class="noborder" width="100%">'
;
print
'<tr class="liste_titre">'
;
print
'<td style="text-align:center;">'
.
$langs
->
trans
(
'Date'
)
.
'</td>'
;
print
'<td colspan="2"></td>'
;
//print '<td style="text-align:center;">'.$langs->trans('Date').'</td>';
print
'<td>'
.
$langs
->
trans
(
'Project'
)
.
'</td>'
;
print
'<td>'
.
$langs
->
trans
(
'Type'
)
.
'</td>'
;
print
'<td
align="center"
>'
.
$langs
->
trans
(
'Type'
)
.
'</td>'
;
print
'<td>'
.
$langs
->
trans
(
'Description'
)
.
'</td>'
;
print
'<td style="text-align:right;">'
.
$langs
->
trans
(
'VAT'
)
.
'</td>'
;
print
'<td style="text-align:right;">'
.
$langs
->
trans
(
'PriceUTTC'
)
.
'</td>'
;
print
'<td style="text-align:right;">'
.
$langs
->
trans
(
'Qty'
)
.
'</td>'
;
print
'<td
style="text-align:center;
"></td>'
;
print
'<td
colspan="3
"></td>'
;
print
'</tr>'
;
print
'<tr '
.
$bc
[
true
]
.
'>'
;
print
'<td></td>'
;
// Select date
print
'<td style="text-align:center;">'
;
$form
->
select_date
(
$date
?
$date
:-
1
,
'date'
);
...
...
@@ -1800,17 +1811,17 @@ else
// Select project
print
'<td>'
;
$formproject
->
select_projects
(
-
1
,
GETPOST
(
'
fk_projet
'
)
,
'fk_projet'
,
0
,
0
,
1
,
1
);
$formproject
->
select_projects
(
-
1
,
$
fk_projet
,
'fk_projet'
,
0
,
0
,
1
,
1
);
print
'</td>'
;
// Select type
print
'<td>'
;
select_type_fees_id
(
GETPOST
(
'
fk_c_type_fees
'
)
,
'fk_c_type_fees'
,
1
);
print
'<td
align="center"
>'
;
select_type_fees_id
(
$
fk_c_type_fees
,
'fk_c_type_fees'
,
1
);
print
'</td>'
;
// Add comments
print
'<td
style="text-align:left;"
>'
;
print
'<textarea class="flat_ndf centpercent" name="comments">'
.
GETPOST
(
'
comments
'
)
.
'</textarea>'
;
print
'<td>'
;
print
'<textarea class="flat_ndf centpercent" name="comments">'
.
$
comments
.
'</textarea>'
;
print
'</td>'
;
// Select VAT
...
...
@@ -1819,28 +1830,37 @@ else
if
(
!
empty
(
$conf
->
global
->
EXPENSEREPORT_NO_DEFAULT_VAT
))
$conf
->
global
->
MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS
=
'none'
;
print
'<select class="flat" name="vatrate">'
;
print
'<option name="none" value="" selected>'
;
print
$form
->
load_tva
(
'vatrate'
,
(
isset
(
$_POST
[
"vatrate"
])
?
$_POST
[
"
vatrate
"
]
:
$defaultvat
),
$mysoc
,
''
,
0
,
0
,
''
,
true
);
print
$form
->
load_tva
(
'vatrate'
,
(
$vatrate
!=
''
?
$
vatrate
:
$defaultvat
),
$mysoc
,
''
,
0
,
0
,
''
,
true
);
print
'</select>'
;
print
'</td>'
;
// Unit price
print
'<td style="text-align:right;">'
;
print
'<input type="text" size="
6
" name="value_unit" value="'
.
GETPOST
(
'
value_unit
'
)
.
'">'
;
print
'<input type="text" size="
5
" name="value_unit" value="'
.
$
value_unit
.
'">'
;
print
'</td>'
;
// Quantity
print
'<td style="text-align:right;">'
;
print
'<input type="text" size="
4
" name="qty" value="'
.
GETPOST
(
'
qty
'
)
.
'">'
;
print
'<input type="text" size="
2
" name="qty" value="'
.
(
$qty
?
$
qty
:
1
)
.
'">'
;
print
'</td>'
;
if
(
$action
!=
'editline'
)
{
print
'<td style="text-align:right;"></td>'
;
print
'<td style="text-align:right;"></td>'
;
}
print
'<td style="text-align:center;"><input type="submit" value="'
.
$langs
->
trans
(
"Add"
)
.
'" name="bouton" class="button"></td>'
;
print
'</tr>'
;
print
'</table>'
;
print
'</form>'
;
}
// Fin si c'est payé/validé
print
'</table>'
;
print
'</form>'
;
print
'</div>'
;
}
else
{
...
...
This diff is collapsed.
Click to expand it.
htdocs/expensereport/class/expensereport.class.php
+
5
−
2
View file @
826c4de2
...
...
@@ -1801,9 +1801,10 @@ class ExpenseReportLine
* @param int $selected preselect status
* @param string $htmlname Name of HTML select
* @param int $useempty 1=Add empty line
* @param int $useshortlabel Use short labels
* @return string HTML select with status
*/
function
select_expensereport_statut
(
$selected
=
''
,
$htmlname
=
'fk_statut'
,
$useempty
=
1
)
function
select_expensereport_statut
(
$selected
=
''
,
$htmlname
=
'fk_statut'
,
$useempty
=
1
,
$useshortlabel
=
0
)
{
global
$db
,
$langs
;
...
...
@@ -1811,7 +1812,9 @@ function select_expensereport_statut($selected='',$htmlname='fk_statut',$useempt
print
'<select class="flat" name="'
.
$htmlname
.
'">'
;
if
(
$useempty
)
print
'<option value="-1"> </option>'
;
foreach
(
$tmpep
->
statuts
as
$key
=>
$val
)
$arrayoflabels
=
$tmpep
->
statuts
;
if
(
$useshortlabel
)
$arrayoflabels
=
$tmpep
->
statuts_short
;
foreach
(
$arrayoflabels
as
$key
=>
$val
)
{
if
(
$selected
!=
''
&&
$selected
==
$key
)
{
...
...
This diff is collapsed.
Click to expand it.
htdocs/expensereport/list.php
+
2
−
2
View file @
826c4de2
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-20
08
Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-20
15
Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
...
...
@@ -257,7 +257,7 @@ if ($resql)
// Status
print
'<td class="liste_titre" align="right">'
;
select_expensereport_statut
(
$search_status
,
'search_status'
);
select_expensereport_statut
(
$search_status
,
'search_status'
,
1
,
1
);
print
'</td>'
;
print
'<td class="liste_titre" align="right">'
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment