From 88ad000d5a4b748ae1edcd6b45b1c1fbbcf456d6 Mon Sep 17 00:00:00 2001 From: oesi Date: Wed, 24 Jun 2015 11:20:12 +0200 Subject: [PATCH] Barcode Encoding Berechnung korrigiert --- include/ean13.function.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/ean13.function.php b/include/ean13.function.php index 600c69fd7..875ac12cd 100644 --- a/include/ean13.function.php +++ b/include/ean13.function.php @@ -36,7 +36,7 @@ function ean13($datatoencode) //Calculate Check Digit $Factor = 3; $weightedTotal = "0"; - for($i=mb_strlen($datatoencode);$i>=0;$i--) + for($i=mb_strlen($datatoencode)-1;$i>=0;$i--) { //Get the value of each number starting at the end $CurrentChar = mb_substr($datatoencode, $i, 1); @@ -91,7 +91,7 @@ function ean13($datatoencode) break; } //add the check digit to the end of the barcode . remove the leading digit - $datatoencode = mb_substr($datatoencode, 0, 12) . $CheckDigit; + $datatoencode = mb_substr($datatoencode, 1, 12) . $CheckDigit; //Now that we have the total number including the check digit, determine character to print //for proper barcoding: $datalen = mb_strlen($datatoencode); @@ -323,4 +323,4 @@ function ean13($datatoencode) //Return PrintableString return $Printable_string; -} \ No newline at end of file +}