fixup! fix phpstan (#28727)
This commit is contained in:
parent
77c10d653e
commit
eefe123dcb
1 changed files with 12 additions and 6 deletions
|
|
@ -4,6 +4,7 @@
|
|||
* Copyright (C) 2007-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -157,14 +158,19 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
|
|||
/**
|
||||
* Return next value
|
||||
*
|
||||
* @param Product $objproduct Object product
|
||||
* @param string $type Type of barcode (EAN, ISBN, ...)
|
||||
* @param CommonObject $objproduct Object product
|
||||
* @param string $type Type of barcode (EAN, ISBN, ...)
|
||||
* @return string Value if OK, '' if module not configured, <0 if KO
|
||||
*/
|
||||
public function getNextValue($objproduct, $type = '')
|
||||
{
|
||||
global $db, $conf;
|
||||
|
||||
if (!$objproduct instanceof Product) {
|
||||
dol_syslog(get_class($this)."::getNextValue used on incompatible".get_class($objproduct), LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/barcode.lib.php'; // to be able to call function barcode_gen_ean_sum($ean)
|
||||
|
||||
|
|
@ -192,19 +198,19 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
|
|||
|
||||
$numFinal = get_next_value($db, $mask, 'product', $field, $where, '', $now);
|
||||
//Begin barcode with key: for barcode with key (EAN13...) calculate and substitute the last character (* or ?) used in the mask by the key
|
||||
if ((substr($numFinal, -1)=='*') or (substr($numFinal, -1)=='?')) { // if last mask character is * or ? a joker, probably we have to calculate a key as last character (EAN13...)
|
||||
if ((substr($numFinal, -1) == '*') or (substr($numFinal, -1) == '?')) { // if last mask character is * or ? a joker, probably we have to calculate a key as last character (EAN13...)
|
||||
$literaltype = '';
|
||||
$literaltype = $this->literalBarcodeType($db, $type);//get literal_Barcode_Type
|
||||
switch ($literaltype) {
|
||||
case 'EAN13': //EAN13 rowid = 2
|
||||
if (strlen($numFinal)==13) {// be sure that the mask length is correct for EAN13
|
||||
if (strlen($numFinal) == 13) {// be sure that the mask length is correct for EAN13
|
||||
$ean = substr($numFinal, 0, 12); //take first 12 digits
|
||||
$eansum = barcode_gen_ean_sum($ean);
|
||||
$eansum = barcode_gen_ean_sum($ean);
|
||||
$ean .= $eansum; //substitute the las character by the key
|
||||
$numFinal = $ean;
|
||||
}
|
||||
break;
|
||||
// Other barcode cases with key could be written here
|
||||
// Other barcode cases with key could be written here
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue