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
9b4b096e
Commit
9b4b096e
authored
7 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Debug variant module
parent
8e25155f
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/variants/card.php
+10
-10
10 additions, 10 deletions
htdocs/variants/card.php
htdocs/variants/create_val.php
+72
-26
72 additions, 26 deletions
htdocs/variants/create_val.php
with
82 additions
and
36 deletions
htdocs/variants/card.php
+
10
−
10
View file @
9b4b096e
...
...
@@ -19,13 +19,13 @@ require '../main.inc.php';
require
'class/ProductAttribute.class.php'
;
require
'class/ProductAttributeValue.class.php'
;
$id
=
GETPOST
(
'id'
);
$valueid
=
GETPOST
(
'valueid'
);
$action
=
GETPOST
(
'action'
);
$label
=
GETPOST
(
'label'
);
$ref
=
GETPOST
(
'ref'
);
$confirm
=
GETPOST
(
'confirm'
);
$cancel
=
GETPOST
(
'cancel'
);
$id
=
GETPOST
(
'id'
,
'int'
);
$valueid
=
GETPOST
(
'valueid'
,
'alpha'
);
$action
=
GETPOST
(
'action'
,
'alpha'
);
$label
=
GETPOST
(
'label'
,
'alpha'
);
$ref
=
GETPOST
(
'ref'
,
'alpha'
);
$confirm
=
GETPOST
(
'confirm'
,
'alpha'
);
$cancel
=
GETPOST
(
'cancel'
,
'alpha'
);
$object
=
new
ProductAttribute
(
$db
);
$objectval
=
new
ProductAttributeValue
(
$db
);
...
...
@@ -92,10 +92,10 @@ if ($confirm == 'yes') {
setEventMessage
(
$langs
->
trans
(
'RecordSaved'
));
header
(
'Location: '
.
dol_buildpath
(
'/variants/list.php'
,
2
));
}
exit
();
}
elseif
(
$action
==
'confirm_deletevalue'
)
{
}
elseif
(
$action
==
'confirm_deletevalue'
)
{
if
(
$objectval
->
fetch
(
$valueid
)
>
0
)
{
if
(
$objectval
->
delete
()
<
1
)
{
...
...
This diff is collapsed.
Click to expand it.
htdocs/variants/create_val.php
+
72
−
26
View file @
9b4b096e
<?php
/* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -20,83 +19,130 @@ require '../main.inc.php';
require
'class/ProductAttribute.class.php'
;
require
'class/ProductAttributeValue.class.php'
;
$id
=
GETPOST
(
'id'
);
$ref
=
GETPOST
(
'ref'
);
$value
=
GETPOST
(
'value'
);
$id
=
GETPOST
(
'id'
,
'int'
);
$ref
=
GETPOST
(
'ref'
,
'alpha'
);
$value
=
GETPOST
(
'value'
,
'alpha'
);
$action
=
GETPOST
(
'action'
,
'alpha'
);
$cancel
=
GETPOST
(
'cancel'
,
'alpha'
);
$backtopage
=
GETPOST
(
'backtopage'
,
'alpha'
);
$
prodattr
=
new
ProductAttribute
(
$db
);
$
prodattr
val
=
new
ProductAttributeValue
(
$db
);
$
object
=
new
ProductAttribute
(
$db
);
$
object
val
=
new
ProductAttributeValue
(
$db
);
if
(
$
prodattr
->
fetch
(
$id
)
<
1
)
{
if
(
$
object
->
fetch
(
$id
)
<
1
)
{
dol_print_error
(
$db
,
$langs
->
trans
(
'ErrorRecordNotFound'
));
exit
();
}
if
(
$_POST
)
{
/*
* Actions
*/
if
(
$cancel
)
{
$action
=
''
;
header
(
'Location: '
.
DOL_URL_ROOT
.
'/variants/card.php?id='
.
$object
->
id
);
exit
();
}
// None
/*
* View
*/
if
(
$action
==
'add'
)
{
if
(
empty
(
$ref
)
||
empty
(
$value
))
{
setEventMessage
(
$langs
->
trans
(
'ErrorFieldsRequired'
),
'errors'
);
}
else
{
$
prodattr
val
->
fk_product_attribute
=
$
prodattr
->
id
;
$
prodattr
val
->
ref
=
$ref
;
$
prodattr
val
->
value
=
$value
;
$
object
val
->
fk_product_attribute
=
$
object
->
id
;
$
object
val
->
ref
=
$ref
;
$
object
val
->
value
=
$value
;
if
(
$
prodattr
val
->
create
()
>
0
)
{
if
(
$
object
val
->
create
()
>
0
)
{
setEventMessage
(
$langs
->
trans
(
'RecordSaved'
));
header
(
'Location: '
.
dol_buildpath
(
'/variants/card.php?id='
.
$
prodattr
->
id
,
2
)
);
header
(
'Location: '
.
DOL_URL_ROOT
.
'/variants/card.php?id='
.
$
object
->
id
);
exit
();
}
else
{
setEventMessage
(
$langs
->
trans
(
'ErrorCreatingProductAttributeValue'
),
'errors'
);
}
}
}
$langs
->
load
(
'products'
);
$title
=
$langs
->
trans
(
'ProductAttributeName'
,
dol_htmlentities
(
$
prodattr
->
label
));
$title
=
$langs
->
trans
(
'ProductAttributeName'
,
dol_htmlentities
(
$
object
->
label
));
llxHeader
(
''
,
$title
);
print_fiche_titre
(
$title
);
$h
=
0
;
$head
[
$h
][
0
]
=
DOL_URL_ROOT
.
'/variants/card.php?id='
.
$object
->
id
;
$head
[
$h
][
1
]
=
$langs
->
trans
(
"Card"
);
$head
[
$h
][
2
]
=
'variant'
;
$h
++
;
dol_fiche_head
();
dol_fiche_head
(
$head
,
'variant'
,
$langs
->
trans
(
'ProductAttributeName'
),
-
1
,
'generic'
);
print
'<div class="fichecenter">'
;
print
'<div class="underbanner clearboth"></div>'
;
?>
<table
class=
"border"
style=
"width: 100%"
>
<tr>
<td
style=
"width: 15%"
class=
"
fieldrequired"
>
<?php
echo
$langs
->
trans
(
'Ref'
)
?>
</td>
<td>
<?php
echo
dol_htmlentities
(
$
prodattr
->
ref
)
?>
<td
class=
"titlefield
fieldrequired"
>
<?php
echo
$langs
->
trans
(
'Ref'
)
?>
</td>
<td>
<?php
echo
dol_htmlentities
(
$
object
->
ref
)
?>
</tr>
<tr>
<td
style=
"width: 15%"
class=
"fieldrequired"
>
<?php
echo
$langs
->
trans
(
'Label'
)
?>
</td>
<td>
<?php
echo
dol_htmlentities
(
$
prodattr
->
label
)
?>
</td>
<td
class=
"fieldrequired"
>
<?php
echo
$langs
->
trans
(
'Label'
)
?>
</td>
<td>
<?php
echo
dol_htmlentities
(
$
object
->
label
)
?>
</td>
</tr>
</table>
<?php
print
'</div>'
;
dol_fiche_end
();
print
'<br>'
;
print
'<form action="'
.
$_SERVER
[
"PHP_SELF"
]
.
'" method="POST">'
;
print
'<input type="hidden" name="token" value="'
.
$_SESSION
[
'newtoken'
]
.
'">'
;
print
'<input type="hidden" name="action" value="add">'
;
print
'<input type="hidden" name="id" value="'
.
$object
->
id
.
'">'
;
print
'<input type="hidden" name="backtopage" value="'
.
$backtopage
.
'">'
;
print_fiche_titre
(
$langs
->
trans
(
'NewProductAttributeValue'
));
dol_fiche_head
();
?>
<form
method=
"post"
>
<table
class=
"border"
style=
"width: 100%"
>
<tr>
<td
style=
"width: 15%"
class=
"
fieldrequired"
><label
for=
"ref"
>
<?php
echo
$langs
->
trans
(
'Ref'
)
?>
</label></td>
<td
class=
"titlefield
fieldrequired"
><label
for=
"ref"
>
<?php
echo
$langs
->
trans
(
'Ref'
)
?>
</label></td>
<td><input
id=
"ref"
type=
"text"
name=
"ref"
value=
"
<?php
echo
$ref
?>
"
></td>
</tr>
<tr>
<td
style=
"width: 15%"
class=
"fieldrequired"
><label
for=
"value"
>
<?php
echo
$langs
->
trans
(
'Value'
)
?>
</label></td>
<td
class=
"fieldrequired"
><label
for=
"value"
>
<?php
echo
$langs
->
trans
(
'Value'
)
?>
</label></td>
<td><input
id=
"value"
type=
"text"
name=
"value"
value=
"
<?php
echo
$value
?>
"
></td>
</tr>
</table>
<?php
dol_fiche_end
();
print
'<div class="center"><input type="submit" class="button" value="'
.
$langs
->
trans
(
"Create"
)
.
'"></div></form>'
;
print
'<div class="center">'
;
print
'<input type="submit" class="button" name="create" value="'
.
$langs
->
trans
(
"Create"
)
.
'">'
;
print
' '
;
print
'<input type="submit" class="button" name="cancel" value="'
.
$langs
->
trans
(
"Cancel"
)
.
'">'
;
print
'</div>'
;
print
'</form>'
;
llxFooter
();
\ No newline at end of file
llxFooter
();
$db
->
close
();
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