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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
ed4a0742
Commit
ed4a0742
authored
Jan 30, 2012
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Add a test to be sure module is on
parent
1e8fd738
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/product/class/product.class.php
+7
-23
7 additions, 23 deletions
htdocs/product/class/product.class.php
test/phpunit/ProductTest.php
+2
-0
2 additions, 0 deletions
test/phpunit/ProductTest.php
with
9 additions
and
23 deletions
htdocs/product/class/product.class.php
+
7
−
23
View file @
ed4a0742
...
...
@@ -526,23 +526,6 @@ class Product extends CommonObject
{
$this
->
db
->
begin
();
// Delete supplier prices log
/*if (! $error)
{
$sql = 'DELETE pfpl';
$sql.= ' FROM '.MAIN_DB_PREFIX.'product_fournisseur_price_log as pfpl, '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp';
$sql.= ' WHERE pfpl.fk_product_fournisseur = pfp.rowid';
$sql.= ' AND pf.fk_product = '.$id;
dol_syslog(get_class($this).'::delete sql='.$sql, LOG_DEBUG);
$result = $this->db->query($sql);
if (! $result)
{
$error++;
$this->error = $this->db->lasterror();
dol_syslog(get_class($this).'::delete error '.$this->error, LOG_ERR);
}
}*/
// Delete supplier prices
if
(
!
$error
)
{
...
...
@@ -639,6 +622,7 @@ class Product extends CommonObject
return
0
;
}
}
return
0
;
}
/**
...
...
@@ -1018,13 +1002,13 @@ class Product extends CommonObject
global
$langs
,
$conf
;
dol_syslog
(
"Product
::fetch id=
$id
ref=
$ref
ref_ext=
$ref_ext
"
);
dol_syslog
(
get_class
(
$this
)
.
"
::fetch id=
"
.
$id
.
"
ref=
"
.
$ref
.
"
ref_ext=
"
.
$ref_ext
);
// Check parameters
if
(
!
$id
&&
!
$ref
&&
!
$ref_ext
)
{
$this
->
error
=
$langs
->
trans
(
'ErrorWrongParameters'
);
dol_print_error
(
"Product
::fetch "
.
$this
->
error
,
LOG_ERR
);
dol_print_error
(
get_class
(
$this
)
.
"
::fetch "
.
$this
->
error
,
LOG_ERR
);
return
-
1
;
}
...
...
@@ -1039,7 +1023,7 @@ class Product extends CommonObject
else
if
(
$ref
)
$sql
.
=
" WHERE ref = '"
.
$this
->
db
->
escape
(
$ref
)
.
"'"
;
else
if
(
$ref_ext
)
$sql
.
=
" WHERE ref_ext = '"
.
$this
->
db
->
escape
(
$ref_ext
)
.
"'"
;
dol_syslog
(
"Product
::fetch sql="
.
$sql
);
dol_syslog
(
get_class
(
$this
)
.
"
::fetch sql="
.
$sql
);
$resql
=
$this
->
db
->
query
(
$sql
);
if
(
$resql
)
{
...
...
@@ -2371,7 +2355,7 @@ class Product extends CommonObject
/**
* Load information about stock of a product into stock_warehouse[] and stock_reel
*
* @return int < 0
si erreur
, > 0
si ok
* @return int < 0
if KO
, > 0
if OK
*/
function
load_stock
()
{
...
...
@@ -2381,7 +2365,7 @@ class Product extends CommonObject
$sql
.
=
" FROM "
.
MAIN_DB_PREFIX
.
"product_stock"
;
$sql
.
=
" WHERE fk_product = '"
.
$this
->
id
.
"'"
;
dol_syslog
(
"Product
::load_stock sql="
.
$sql
);
dol_syslog
(
get_class
(
$this
)
.
"
::load_stock sql="
.
$sql
);
$result
=
$this
->
db
->
query
(
$sql
);
if
(
$result
)
{
...
...
@@ -2403,7 +2387,7 @@ class Product extends CommonObject
}
else
{
$this
->
error
=
$this
->
db
->
error
();
$this
->
error
=
$this
->
db
->
last
error
();
return
-
1
;
}
}
...
...
...
...
This diff is collapsed.
Click to expand it.
test/phpunit/ProductTest.php
+
2
−
0
View file @
ed4a0742
...
...
@@ -77,6 +77,8 @@ class ProductTest extends PHPUnit_Framework_TestCase
{
global
$conf
,
$user
,
$langs
,
$db
;
if
(
empty
(
$conf
->
produit
->
enabled
))
{
print
__METHOD__
.
" Module Product must be enabled.
\n
"
;
die
();
}
$db
->
begin
();
// This is to have all actions inside a transaction even if test launched without suite.
print
__METHOD__
.
"
\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