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
9d4d85ca
Commit
9d4d85ca
authored
7 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Plain Diff
Merge branch '6.0' of git@github.com:Dolibarr/dolibarr.git into 6.0
parents
d37d1a03
5c530810
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/resource/add.php
+63
-55
63 additions, 55 deletions
htdocs/resource/add.php
htdocs/resource/card.php
+5
-2
5 additions, 2 deletions
htdocs/resource/card.php
with
68 additions
and
57 deletions
htdocs/resource/add.php
+
63
−
55
View file @
9d4d85ca
...
...
@@ -66,63 +66,71 @@ $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels
=
$extrafields
->
fetch_name_optionals_label
(
$object
->
table_element
);
if
(
$action
==
'confirm_add_resource'
)
$hookmanager
->
initHooks
(
array
(
'resource_card_add'
,
'globalcard'
));
$parameters
=
array
();
$reshook
=
$hookmanager
->
executeHooks
(
'doActions'
,
$parameters
,
$object
,
$action
);
// Note that $action and $object may have been modified by some hooks
if
(
$reshook
<
0
)
setEventMessages
(
$hookmanager
->
error
,
$hookmanager
->
errors
,
'errors'
);
if
(
empty
(
$reshook
))
{
if
(
!
$cancel
)
{
$error
=
''
;
$ref
=
GETPOST
(
'ref'
,
'alpha'
);
$description
=
GETPOST
(
'description'
,
'alpha'
);
$fk_code_type_resource
=
GETPOST
(
'fk_code_type_resource'
,
'alpha'
);
if
(
empty
(
$ref
))
{
$mesg
=
$langs
->
trans
(
"ErrorFieldRequired"
,
$langs
->
transnoentities
(
"Ref"
));
setEventMessages
(
$mesg
,
null
,
'errors'
);
$error
++
;
}
if
(
!
$error
)
{
$object
=
new
Dolresource
(
$db
);
$object
->
ref
=
$ref
;
$object
->
description
=
$description
;
$object
->
fk_code_type_resource
=
$fk_code_type_resource
;
// Fill array 'array_options' with data from add form
$ret
=
$extrafields
->
setOptionalsFromPost
(
$extralabels
,
$object
);
if
(
$ret
<
0
)
{
$error
++
;
}
$result
=
$object
->
create
(
$user
);
if
(
$result
>
0
)
{
// Creation OK
$db
->
commit
();
setEventMessages
(
$langs
->
trans
(
'ResourceCreatedWithSuccess'
),
null
,
'mesgs'
);
Header
(
"Location: card.php?id="
.
$object
->
id
);
return
;
}
else
{
// Creation KO
setEventMessages
(
$object
->
error
,
$object
->
errors
,
'errors'
);
$action
=
''
;
}
}
else
{
$action
=
''
;
}
}
else
{
Header
(
"Location: list.php"
);
}
}
if
(
$action
==
'confirm_add_resource'
)
{
if
(
!
$cancel
)
{
$error
=
''
;
$ref
=
GETPOST
(
'ref'
,
'alpha'
);
$description
=
GETPOST
(
'description'
,
'alpha'
);
$fk_code_type_resource
=
GETPOST
(
'fk_code_type_resource'
,
'alpha'
);
if
(
empty
(
$ref
))
{
$mesg
=
$langs
->
trans
(
"ErrorFieldRequired"
,
$langs
->
transnoentities
(
"Ref"
));
setEventMessages
(
$mesg
,
null
,
'errors'
);
$error
++
;
}
if
(
!
$error
)
{
$object
=
new
Dolresource
(
$db
);
$object
->
ref
=
$ref
;
$object
->
description
=
$description
;
$object
->
fk_code_type_resource
=
$fk_code_type_resource
;
// Fill array 'array_options' with data from add form
$ret
=
$extrafields
->
setOptionalsFromPost
(
$extralabels
,
$object
);
if
(
$ret
<
0
)
{
$error
++
;
}
$result
=
$object
->
create
(
$user
);
if
(
$result
>
0
)
{
// Creation OK
$db
->
commit
();
setEventMessages
(
$langs
->
trans
(
'ResourceCreatedWithSuccess'
),
null
,
'mesgs'
);
Header
(
"Location: card.php?id="
.
$object
->
id
);
return
;
}
else
{
// Creation KO
setEventMessages
(
$object
->
error
,
$object
->
errors
,
'errors'
);
$action
=
''
;
}
}
else
{
$action
=
''
;
}
}
else
{
Header
(
"Location: list.php"
);
}
}
}
/*
* View
...
...
This diff is collapsed.
Click to expand it.
htdocs/resource/card.php
+
5
−
2
View file @
9d4d85ca
...
...
@@ -54,10 +54,13 @@ if ($user->societe_id > 0)
accessforbidden
();
}
if
(
!
$user
->
rights
->
resource
->
read
)
if
(
!
$user
->
rights
->
resource
->
read
)
accessforbidden
();
$object
=
new
Dolresource
(
$db
);
$objectFetchRes
=
$object
->
fetch
(
$id
);
if
(
!
(
$objectFetchRes
>
0
))
dol_print_error
(
$db
,
$object
->
error
);
$extrafields
=
new
ExtraFields
(
$db
);
...
...
@@ -162,7 +165,7 @@ llxHeader('',$pagetitle,'');
$form
=
new
Form
(
$db
);
$formresource
=
new
FormResource
(
$db
);
if
(
$object
->
f
etch
(
$id
)
>
0
)
if
(
$object
F
etch
Res
>
0
)
{
$head
=
resource_prepare_head
(
$object
);
...
...
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