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
294b4865
Commit
294b4865
authored
12 years ago
by
Philippe Grand
Browse files
Options
Downloads
Patches
Plain Diff
normalize and simplify code
parent
29b8ce1c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
htdocs/admin/supplier_invoice.php
+35
-63
35 additions, 63 deletions
htdocs/admin/supplier_invoice.php
with
35 additions
and
63 deletions
htdocs/admin/supplier_invoice.php
+
35
−
63
View file @
294b4865
...
...
@@ -53,10 +53,10 @@ $specimenthirdparty->initAsSpecimen();
if
(
$action
==
'updateMask'
)
{
$maskconst
order
=
GETPOST
(
'maskconst
order
'
,
'alpha'
);
$mask
order
=
GETPOST
(
'mask
order
'
,
'alpha'
);
$maskconst
invoice
=
GETPOST
(
'maskconst
invoice
'
,
'alpha'
);
$mask
value
=
GETPOST
(
'mask
value
'
,
'alpha'
);
if
(
$maskconst
order
)
$res
=
dolibarr_set_const
(
$db
,
$maskconst
order
,
$mask
order
,
'chaine'
,
0
,
''
,
$conf
->
entity
);
if
(
$maskconst
invoice
)
$res
=
dolibarr_set_const
(
$db
,
$maskconst
invoice
,
$mask
value
,
'chaine'
,
0
,
''
,
$conf
->
entity
);
if
(
!
$res
>
0
)
$error
++
;
...
...
@@ -116,71 +116,37 @@ if ($action == 'specimen') // For invoices
}
}
if
(
$action
==
'set'
)
// Activate a model
else
if
(
$action
==
'set'
)
{
$label
=
GETPOST
(
'label'
,
'alpha'
);
$scandir
=
GETPOST
(
'scandir'
,
'alpha'
);
$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
.
=
")"
;
$res
=
$db
->
query
(
$sql
);
if
(
$res
)
{
}
// else dol_print_error($db);
$ret
=
addDocumentModel
(
$value
,
$type
,
$label
,
$scandir
);
}
if
(
$action
==
'del'
)
else
if
(
$action
==
'del'
)
{
$sql
=
"DELETE FROM "
.
MAIN_DB_PREFIX
.
"document_model"
;
$sql
.
=
" WHERE nom = '"
.
$value
.
"'"
;
$sql
.
=
" AND type = '"
.
$type
.
"'"
;
$sql
.
=
" AND entity = "
.
$conf
->
entity
;
$db
->
query
(
$sql
);
if
(
$res
)
{
}
// else dol_print_error($db);
$ret
=
delDocumentModel
(
$value
,
$type
);
if
(
$ret
>
0
)
{
if
(
$conf
->
global
->
INVOICE_SUPPLIER_ADDON_PDF
==
"
$value
"
)
dolibarr_del_const
(
$db
,
'INVOICE_SUPPLIER_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
(
$type
==
'order_supplier'
&&
dolibarr_set_const
(
$db
,
"INVOICE_SUPPLIER_ADDON_PDF"
,
$value
,
'chaine'
,
0
,
''
,
$conf
->
entity
))
{
$conf
->
global
->
INVOICE_SUPPLIER_ADDON_PDF
=
$value
;
}
// On active le modele
$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
;
$result1
=
$db
->
query
(
$sql_del
);
$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
.
=
")"
;
$result2
=
$db
->
query
(
$sql
);
if
(
$result1
&&
$result2
)
{
$db
->
commit
();
}
else
{
$db
->
rollback
();
}
if
(
dolibarr_set_const
(
$db
,
"INVOICE_SUPPLIER_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
->
INVOICE_SUPPLIER_ADDON_PDF
=
$value
;
}
// On active le modele
$ret
=
delDocumentModel
(
$value
,
$type
);
if
(
$ret
>
0
)
{
$ret
=
addDocumentModel
(
$value
,
$type
,
$label
,
$scandir
);
}
}
if
(
$action
==
'setmod'
)
...
...
@@ -294,7 +260,7 @@ foreach ($dirmodels as $reldir)
print
$module
->
info
();
print
'</td>'
;
// Show example of numbering mod
ul
e
// Show example of numbering mode
l
print
'<td nowrap="nowrap">'
;
$tmp
=
$module
->
getExample
();
if
(
preg_match
(
'/^Error/'
,
$tmp
))
{
...
...
@@ -447,7 +413,7 @@ foreach ($dirmodels as $reldir)
print
"</td>"
;
}
// Defaut
// Defau
l
t
print
'<td align="center">'
;
if
(
$conf
->
global
->
INVOICE_SUPPLIER_ADDON_PDF
==
"
$name
"
)
{
...
...
@@ -484,6 +450,12 @@ foreach ($dirmodels as $reldir)
}
print
'</table><br/>'
;
print
'<br>'
;
/*
* Other options
*
*/
print_titre
(
$langs
->
trans
(
"OtherOptions"
));
print
'<table class="noborder" width="100%">'
;
...
...
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