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
1683609d
Commit
1683609d
authored
9 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
FIX Check of EAN13 barcode when mask was set to use 13 digits instead of
12
parent
1ded08ab
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/core/modules/barcode/mod_barcode_product_standard.php
+11
-3
11 additions, 3 deletions
htdocs/core/modules/barcode/mod_barcode_product_standard.php
with
11 additions
and
3 deletions
htdocs/core/modules/barcode/mod_barcode_product_standard.php
+
11
−
3
View file @
1683609d
...
...
@@ -227,7 +227,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
* Return if a code is used (by other element)
*
* @param DoliDB $db Handler acces base
* @param string $code Code
a verifier
* @param string $code Code
to check
* @param Product $product Objet product
* @return int 0 if available, <0 if KO
*/
...
...
@@ -277,12 +277,20 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
return
''
;
}
dol_syslog
(
get_class
(
$this
)
.
'::verif_syntax codefortest='
.
$codefortest
.
" typefortest="
.
$typefortest
);
$newcodefortest
=
$codefortest
;
// Special case, if mask is on 12 digits instead of 13, we remove last char into code to test
if
(
in_array
(
$typefortest
,
array
(
'EAN13'
,
'ISBN'
)))
// We remove the CRC char not included into mask
{
$newcodefortest
=
substr
(
$newcodefortest
,
0
,
12
);
if
(
preg_match
(
'/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i'
,
$mask
,
$reg
))
{
if
(
strlen
(
$reg
[
1
])
==
12
)
$newcodefortest
=
substr
(
$newcodefortest
,
0
,
12
);
dol_syslog
(
get_class
(
$this
)
.
'::verif_syntax newcodefortest='
.
$newcodefortest
);
}
}
$result
=
check_value
(
$mask
,
$newcodefortest
);
return
$result
;
...
...
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