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
5e131976
Commit
5e131976
authored
17 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Simplification du cache de htmlform
parent
abb57def
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
htdocs/html.form.class.php
+61
-59
61 additions, 59 deletions
htdocs/html.form.class.php
with
61 additions
and
59 deletions
htdocs/html.form.class.php
+
61
−
59
View file @
5e131976
...
...
@@ -44,14 +44,14 @@ class Form
var
$db
;
var
$error
;
var
$cache_types_paiements_code
=
array
();
var
$cache_types_paiements_libelle
=
array
();
var
$cache_conditions_paiements_code
=
array
();
var
$cache_conditions_paiements_libelle
=
array
();
// Cache arrays
var
$cache_types_paiements
=
array
();
var
$cache_conditions_paiements
=
array
();
var
$tva_taux_value
;
var
$tva_taux_libelle
;
/**
\brief Constructeur
\param DB handler d'accs base de donne
...
...
@@ -1285,7 +1285,7 @@ class Form
{
global
$langs
;
if
(
sizeof
(
$this
->
cache_conditions_paiements
_code
))
return
0
;
// Cache dja charg
if
(
sizeof
(
$this
->
cache_conditions_paiements
))
return
0
;
// Cache dja charg
dolibarr_syslog
(
'Form::load_cache_conditions_paiements'
,
LOG_DEBUG
);
...
...
@@ -1296,7 +1296,7 @@ class Form
$resql
=
$this
->
db
->
query
(
$sql
);
if
(
$resql
)
{
$num
=
$this
->
db
->
num_rows
(
$res
ult
);
$num
=
$this
->
db
->
num_rows
(
$res
ql
);
$i
=
0
;
while
(
$i
<
$num
)
{
...
...
@@ -1304,8 +1304,8 @@ class Form
// Si traduction existe, on l'utilise, sinon on prend le libell par dfaut
$libelle
=
(
$langs
->
trans
(
"PaymentConditionShort"
.
$obj
->
code
)
!=
(
"PaymentConditionShort"
.
$obj
->
code
)
?
$langs
->
trans
(
"PaymentConditionShort"
.
$obj
->
code
)
:
(
$obj
->
libelle
!=
'-'
?
$obj
->
libelle
:
''
));
$this
->
cache_conditions_paiements
_code
[
$obj
->
rowid
]
=
$obj
->
code
;
$this
->
cache_conditions_paiements
_libelle
[
$obj
->
rowid
]
=
$libelle
;
$this
->
cache_conditions_paiements
[
$obj
->
rowid
]
[
'code'
]
=
$obj
->
code
;
$this
->
cache_conditions_paiements
[
$obj
->
rowid
]
[
'label'
]
=
$libelle
;
$i
++
;
}
return
1
;
...
...
@@ -1324,7 +1324,7 @@ class Form
{
global
$langs
;
if
(
sizeof
(
$this
->
cache_types_paiements
_code
))
return
0
;
// Cache dja charg
if
(
sizeof
(
$this
->
cache_types_paiements
))
return
0
;
// Cache dja charg
dolibarr_syslog
(
'Form::load_cache_types_paiements'
,
LOG_DEBUG
);
...
...
@@ -1335,7 +1335,7 @@ class Form
$resql
=
$this
->
db
->
query
(
$sql
);
if
(
$resql
)
{
$num
=
$this
->
db
->
num_rows
(
$res
ult
);
$num
=
$this
->
db
->
num_rows
(
$res
ql
);
$i
=
0
;
while
(
$i
<
$num
)
{
...
...
@@ -1343,9 +1343,9 @@ class Form
// Si traduction existe, on l'utilise, sinon on prend le libell par dfaut
$libelle
=
(
$langs
->
trans
(
"PaymentTypeShort"
.
$obj
->
code
)
!=
(
"PaymentTypeShort"
.
$obj
->
code
)
?
$langs
->
trans
(
"PaymentTypeShort"
.
$obj
->
code
)
:
(
$obj
->
libelle
!=
'-'
?
$obj
->
libelle
:
''
));
$this
->
cache_types_paiements
_code
[
$obj
->
id
]
=
$obj
->
code
;
$this
->
cache_types_paiements
_libelle
[
$obj
->
id
]
=
$libelle
;
$this
->
cache_types_paiements
_type
[
$obj
->
id
]
=
$obj
->
type
;
$this
->
cache_types_paiements
[
$obj
->
id
]
[
'code'
]
=
$obj
->
code
;
$this
->
cache_types_paiements
[
$obj
->
id
]
[
'label'
]
=
$libelle
;
$this
->
cache_types_paiements
[
$obj
->
id
]
[
'type'
]
=
$obj
->
type
;
$i
++
;
}
return
$num
;
...
...
@@ -1373,7 +1373,7 @@ class Form
print
'<select class="flat" name="'
.
$htmlname
.
'">'
;
if
(
$addempty
)
print
'<option value="0"> </option>'
;
foreach
(
$this
->
cache_conditions_paiements
_code
as
$id
=>
$
code
)
foreach
(
$this
->
cache_conditions_paiements
as
$id
=>
$
arrayconditions
)
{
if
(
$selected
==
$id
)
{
...
...
@@ -1383,39 +1383,12 @@ class Form
{
print
'<option value="'
.
$id
.
'">'
;
}
print
$
this
->
cache_conditions_paiements_libelle
[
$id
];
print
$
arrayconditions
[
'label'
];
print
'</option>'
;
}
print
'</select>'
;
}
/**
* \brief Selection HT ou TTC
* \param selected Id pr-slectionn
* \param htmlname Nom de la zone select
*/
function
select_PriceBaseType
(
$selected
=
''
,
$htmlname
=
'price_base_type'
)
{
global
$langs
;
print
'<select class="flat" name="'
.
$htmlname
.
'">'
;
$options
=
array
(
'HT'
=>
$langs
->
trans
(
"HT"
),
'TTC'
=>
$langs
->
trans
(
"TTC"
)
);
foreach
(
$options
as
$id
=>
$value
)
{
if
(
$selected
==
$id
)
{
print
'<option value="'
.
$id
.
'" selected="true">'
.
$value
;
}
else
{
print
'<option value="'
.
$id
.
'">'
.
$value
;
}
print
'</option>'
;
}
print
'</select>'
;
}
/**
* \brief Retourne la liste des modes de paiements possibles
...
...
@@ -1440,26 +1413,55 @@ class Form
print
'<select class="flat" name="'
.
$htmlname
.
'">'
;
if
(
$empty
)
print
'<option value=""> </option>'
;
foreach
(
$this
->
cache_types_paiements
_code
as
$id
=>
$
code
)
foreach
(
$this
->
cache_types_paiements
as
$id
=>
$
arraytypes
)
{
// On passe si on a demand de filtrer sur des modes de paiments particuliers
if
(
sizeof
(
$filterarray
)
&&
!
in_array
(
$
this
->
cache_types_paiements_type
[
$id
],
$filterarray
))
continue
;
if
(
sizeof
(
$filterarray
)
&&
!
in_array
(
$
arraytypes
[
'type'
],
$filterarray
))
continue
;
if
(
$format
==
0
)
print
'<option value="'
.
$id
.
'"'
;
if
(
$format
==
1
)
print
'<option value="'
.
$code
.
'"'
;
if
(
$format
==
2
)
print
'<option value="'
.
$code
.
'"'
;
if
(
$format
==
1
)
print
'<option value="'
.
$
arraytypes
[
'
code
'
]
.
'"'
;
if
(
$format
==
2
)
print
'<option value="'
.
$
arraytypes
[
'
code
'
]
.
'"'
;
// Si selected est text, on compare avec code, sinon avec id
if
(
eregi
(
'[a-z]'
,
$selected
)
&&
$selected
==
$code
)
print
' selected="true"'
;
if
(
eregi
(
'[a-z]'
,
$selected
)
&&
$selected
==
$
arraytypes
[
'
code
'
]
)
print
' selected="true"'
;
elseif
(
$selected
==
$id
)
print
' selected="true"'
;
print
'>'
;
if
(
$format
==
0
)
$value
=
$
this
->
cache_types_paiements_libelle
[
$id
];
if
(
$format
==
1
)
$value
=
$code
;
if
(
$format
==
2
)
$value
=
$
this
->
cache_types_paiements_libelle
[
$id
];
if
(
$format
==
0
)
$value
=
$
arraytypes
[
'label'
];
if
(
$format
==
1
)
$value
=
$
arraytypes
[
'
code
'
]
;
if
(
$format
==
2
)
$value
=
$
arraytypes
[
'label'
];
print
$value
?
$value
:
' '
;
print
'</option>'
;
}
print
'</select>'
;
}
/**
* \brief Selection HT ou TTC
* \param selected Id pr-slectionn
* \param htmlname Nom de la zone select
*/
function
select_PriceBaseType
(
$selected
=
''
,
$htmlname
=
'price_base_type'
)
{
global
$langs
;
print
'<select class="flat" name="'
.
$htmlname
.
'">'
;
$options
=
array
(
'HT'
=>
$langs
->
trans
(
"HT"
),
'TTC'
=>
$langs
->
trans
(
"TTC"
)
);
foreach
(
$options
as
$id
=>
$value
)
{
if
(
$selected
==
$id
)
{
print
'<option value="'
.
$id
.
'" selected="true">'
.
$value
;
}
else
{
print
'<option value="'
.
$id
.
'">'
.
$value
;
}
print
'</option>'
;
}
print
'</select>'
;
}
/**
* \brief Retourne la liste droulante des diffrents tats d'une propal.
* Les valeurs de la liste sont les id de la table c_propalst
...
...
@@ -1904,7 +1906,7 @@ class Form
if
(
$selected
)
{
$this
->
load_cache_conditions_paiements
();
print
$this
->
cache_conditions_paiements
_libelle
[
$selected
];
print
$this
->
cache_conditions_paiements
[
$selected
]
[
'label'
]
;
}
else
{
print
" "
;
}
...
...
@@ -1969,7 +1971,7 @@ class Form
if
(
$selected
)
{
$this
->
load_cache_types_paiements
();
print
$this
->
cache_types_paiements
_libelle
[
$selected
];
print
$this
->
cache_types_paiements
[
$selected
]
[
'label'
]
;
}
else
{
print
" "
;
}
...
...
@@ -2150,7 +2152,7 @@ class Form
$sql
=
"SELECT code_iso, label, active FROM "
.
MAIN_DB_PREFIX
.
"c_currencies"
;
$sql
.
=
" WHERE active = 1"
;
$sql
.
=
" ORDER BY code_iso ASC
;
"
;
$sql
.
=
" ORDER BY code_iso ASC"
;
if
(
$this
->
db
->
query
(
$sql
))
{
...
...
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