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
3e1d2c3e
Commit
3e1d2c3e
authored
11 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Qual: Mutualized and uniformize code
parent
c4f90f81
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
htdocs/admin/commande.php
+9
-10
9 additions, 10 deletions
htdocs/admin/commande.php
htdocs/admin/facture.php
+27
-62
27 additions, 62 deletions
htdocs/admin/facture.php
htdocs/admin/propal.php
+5
-6
5 additions, 6 deletions
htdocs/admin/propal.php
with
41 additions
and
78 deletions
htdocs/admin/commande.php
+
9
−
10
View file @
3e1d2c3e
...
...
@@ -118,7 +118,7 @@ else if ($action == 'specimen')
}
// Activate a model
else
if
(
$action
==
'set'
)
if
(
$action
==
'set'
)
{
$ret
=
addDocumentModel
(
$value
,
$type
,
$label
,
$scandir
);
}
...
...
@@ -264,14 +264,14 @@ foreach ($dirmodels as $reldir)
require_once
$dir
.
$file
.
'.php'
;
$module
=
new
$file
;
$module
=
new
$file
(
$db
);
// Show modules according to features level
if
(
$module
->
version
==
'development'
&&
$conf
->
global
->
MAIN_FEATURES_LEVEL
<
2
)
continue
;
if
(
$module
->
version
==
'experimental'
&&
$conf
->
global
->
MAIN_FEATURES_LEVEL
<
1
)
continue
;
if
(
$module
->
isEnabled
())
{
// Show modules according to features level
if
(
$module
->
version
==
'development'
&&
$conf
->
global
->
MAIN_FEATURES_LEVEL
<
2
)
continue
;
if
(
$module
->
version
==
'experimental'
&&
$conf
->
global
->
MAIN_FEATURES_LEVEL
<
1
)
continue
;
$var
=!
$var
;
print
'<tr '
.
$bc
[
$var
]
.
'><td>'
.
$module
->
nom
.
"</td><td>
\n
"
;
print
$module
->
info
();
...
...
@@ -323,7 +323,7 @@ foreach ($dirmodels as $reldir)
print
$form
->
textwithpicto
(
''
,
$htmltooltip
,
1
,
0
);
print
'</td>'
;
print
'
</tr>
'
;
print
"
</tr>
\n
"
;
}
}
}
...
...
@@ -331,17 +331,16 @@ foreach ($dirmodels as $reldir)
}
}
}
print
'</table><br>'
;
print
"</table><br>
\n
"
;
/*
* Document templates generators
*/
print_titre
(
$langs
->
trans
(
"OrdersModelModule"
));
// Load array def with activated templates
$type
=
'order'
;
$def
=
array
();
$sql
=
"SELECT nom"
;
$sql
.
=
" FROM "
.
MAIN_DB_PREFIX
.
"document_model"
;
...
...
This diff is collapsed.
Click to expand it.
htdocs/admin/facture.php
+
27
−
62
View file @
3e1d2c3e
...
...
@@ -40,6 +40,9 @@ if (! $user->admin) accessforbidden();
$action
=
GETPOST
(
'action'
,
'alpha'
);
$value
=
GETPOST
(
'value'
,
'alpha'
);
$label
=
GETPOST
(
'label'
,
'alpha'
);
$scandir
=
GETPOST
(
'scandir'
,
'alpha'
);
$type
=
'invoice'
;
/*
...
...
@@ -137,78 +140,40 @@ if ($action == 'setModuleOptions')
}
}
if
(
$action
==
'set'
)
// Activate a model
else
if
(
$action
==
'set'
)
{
$label
=
GETPOST
(
'label'
,
'alpha'
);
$scandir
=
GETPOST
(
'scandir'
,
'alpha'
);
$type
=
'invoice'
;
$sql
=
"INSERT INTO "
.
MAIN_DB_PREFIX
.
"document_model (nom, type, entity, libelle, description)"
;
$sql
.
=
" VALUES ('"
.
$db
->
escape
(
$value
)
.
"','"
.
$type
.
"',"
.
$conf
->
entity
.
", "
;
$sql
.
=
(
$label
?
"'"
.
$db
->
escape
(
$label
)
.
"'"
:
'null'
)
.
", "
;
$sql
.
=
(
!
empty
(
$scandir
)
?
"'"
.
$db
->
escape
(
$scandir
)
.
"'"
:
"null"
);
$sql
.
=
")"
;
if
(
$db
->
query
(
$sql
))
{
}
$ret
=
addDocumentModel
(
$value
,
$type
,
$label
,
$scandir
);
}
if
(
$action
==
'del'
)
else
if
(
$action
==
'del'
)
{
$type
=
'invoice'
;
$sql
=
"DELETE FROM "
.
MAIN_DB_PREFIX
.
"document_model"
;
$sql
.
=
" WHERE nom = '"
.
$db
->
escape
(
$value
)
.
"'"
;
$sql
.
=
" AND type = '"
.
$type
.
"'"
;
$sql
.
=
" AND entity = "
.
$conf
->
entity
;
if
(
$db
->
query
(
$sql
))
{
$ret
=
delDocumentModel
(
$value
,
$type
);
if
(
$ret
>
0
)
{
if
(
$conf
->
global
->
FACTURE_ADDON_PDF
==
"
$value
"
)
dolibarr_del_const
(
$db
,
'FACTURE_ADDON_PDF'
,
$conf
->
entity
);
}
}
}
if
(
$action
==
'setdoc'
)
// Set default model
else
if
(
$action
==
'setdoc'
)
{
$label
=
GETPOST
(
'label'
,
'alpha'
);
$scandir
=
GETPOST
(
'scandir'
,
'alpha'
);
$db
->
begin
();
if
(
dolibarr_set_const
(
$db
,
"FACTURE_ADDON_PDF"
,
$value
,
'chaine'
,
0
,
''
,
$conf
->
entity
))
{
$conf
->
global
->
FACTURE_ADDON_PDF
=
$value
;
}
// On active le modele
$type
=
'invoice'
;
$sql_del
=
"DELETE FROM "
.
MAIN_DB_PREFIX
.
"document_model"
;
$sql_del
.
=
" WHERE nom = '"
.
$db
->
escape
(
$value
)
.
"'"
;
$sql_del
.
=
" AND type = '"
.
$type
.
"'"
;
$sql_del
.
=
" AND entity = "
.
$conf
->
entity
;
dol_syslog
(
"Delete from model table "
.
$sql_del
);
$result1
=
$db
->
query
(
$sql_del
);
$sql
=
"INSERT INTO "
.
MAIN_DB_PREFIX
.
"document_model (nom, type, entity, libelle, description)"
;
$sql
.
=
" VALUES ('"
.
$value
.
"', '"
.
$type
.
"', "
.
$conf
->
entity
.
", "
;
$sql
.
=
(
$label
?
"'"
.
$db
->
escape
(
$label
)
.
"'"
:
'null'
)
.
", "
;
$sql
.
=
(
!
empty
(
$scandir
)
?
"'"
.
$scandir
.
"'"
:
"null"
);
$sql
.
=
")"
;
dol_syslog
(
"Insert into model table "
.
$sql
);
$result2
=
$db
->
query
(
$sql
);
if
(
$result1
&&
$result2
)
{
$db
->
commit
();
}
else
{
dol_syslog
(
"Error "
.
$db
->
lasterror
(),
LOG_ERR
);
$db
->
rollback
();
}
if
(
dolibarr_set_const
(
$db
,
"FACTURE_ADDON_PDF"
,
$value
,
'chaine'
,
0
,
''
,
$conf
->
entity
))
{
// La constante qui a ete lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage coherent
$conf
->
global
->
FACTURE_ADDON_PDF
=
$value
;
}
// On active le modele
$ret
=
delDocumentModel
(
$value
,
$type
);
if
(
$ret
>
0
)
{
$ret
=
addDocumentModel
(
$value
,
$type
,
$label
,
$scandir
);
}
}
if
(
$action
==
'setmod'
)
else
if
(
$action
==
'setmod'
)
{
// TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated
...
...
This diff is collapsed.
Click to expand it.
htdocs/admin/propal.php
+
5
−
6
View file @
3e1d2c3e
...
...
@@ -193,8 +193,7 @@ if ($action == 'setModuleOptions')
}
// Activate a model
if
(
$action
==
'set'
)
{
$ret
=
addDocumentModel
(
$value
,
$type
,
$label
,
$scandir
);
...
...
@@ -359,16 +358,16 @@ print "</table><br>\n";
/*
*
Modeles de document
s
*
Document templates generator
s
*/
print_titre
(
$langs
->
trans
(
"ProposalsPDFModules"
));
//
Defini tableau def de modele propal
//
Load array def with activated templates
$def
=
array
();
$sql
=
"SELECT nom"
;
$sql
.
=
" FROM "
.
MAIN_DB_PREFIX
.
"document_model"
;
$sql
.
=
" WHERE type = '
propal
'"
;
$sql
.
=
" WHERE type = '
"
.
$type
.
"
'"
;
$sql
.
=
" AND entity = "
.
$conf
->
entity
;
$resql
=
$db
->
query
(
$sql
);
if
(
$resql
)
...
...
@@ -390,7 +389,7 @@ else
print
"<table class=
\"
noborder
\"
width=
\"
100%
\"
>
\n
"
;
print
"<tr class=
\"
liste_titre
\"
>
\n
"
;
print
" <td
width=
\"
140
\"
>"
.
$langs
->
trans
(
"Name"
)
.
"</td>
\n
"
;
print
" <td>"
.
$langs
->
trans
(
"Name"
)
.
"</td>
\n
"
;
print
" <td>"
.
$langs
->
trans
(
"Description"
)
.
"</td>
\n
"
;
print
'<td align="center" width="40">'
.
$langs
->
trans
(
"Status"
)
.
"</td>
\n
"
;
print
'<td align="center" width="40">'
.
$langs
->
trans
(
"Default"
)
.
"</td>
\n
"
;
...
...
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