Coder Social home page Coder Social logo

Comments (25)

odiea avatar odiea commented on June 16, 2024

Why is this even in there. It is not in the original barcode sheet? It works without it.
lang="request->getLocale() ?>

from opensourcepos.

objecttothis avatar objecttothis commented on June 16, 2024

Does the language line properly generate without it? If so, then we can just remove it.

from opensourcepos.

odiea avatar odiea commented on June 16, 2024

If you are concerned about the lang line I replaced this with the one from the header. This does not show an error. It appears the only lang file in this is on the title which I have never seen shown. Yes it works just fine without it.

use Config\Services;

$request = Services::request();

<html xmlns="http://www.w3.org/1999/xhtml" lang="<?= $request->getLocale() ?>">

2023-12-20 05_24_03-Generate Barcodes

from opensourcepos.

objecttothis avatar objecttothis commented on June 16, 2024

If the lang line in the title tag works OK without lang="<?= $request->getLocale() ?> then I agree that we should remove it from the code. It may have been added in to appease the IDE linters.

from opensourcepos.

objecttothis avatar objecttothis commented on June 16, 2024

I've pushed several changes which fix some problems, but I believe there are more problems to resolve. For example the config for "Input Formats" is wrong.
image

from opensourcepos.

odiea avatar odiea commented on June 16, 2024

Here is the code I used. Hope it helps

<div class="form-group form-group-sm">
				<?php echo form_label(lang('Config.barcode_formats'), 'barcode_formats', ['class' => 'control-label col-xs-2']) ?>
				<div class='col-xs-4'>
					<?php
					$barcode_formats = json_decode(config('OSPOS')->settings['barcode_formats']);
					echo form_dropdown ([
						'name' => 'barcode_formats[]',
						'id' => 'barcode_formats',
						'options' => !empty($barcode_formats) ? esc(array_combine($barcode_formats, $barcode_formats), 'attr') : [],
						'multiple' => 'multiple',
						'data-role' => 'tagsinput']) ?>
				</div>
			</div>```

from opensourcepos.

objecttothis avatar objecttothis commented on June 16, 2024

Here is the code I used. Hope it helps

<div class="form-group form-group-sm">
				<?php echo form_label(lang('Config.barcode_formats'), 'barcode_formats', ['class' => 'control-label col-xs-2']) ?>
				<div class='col-xs-4'>
					<?php
					$barcode_formats = json_decode(config('OSPOS')->settings['barcode_formats']);
					echo form_dropdown ([
						'name' => 'barcode_formats[]',
						'id' => 'barcode_formats',
						'options' => !empty($barcode_formats) ? esc(array_combine($barcode_formats, $barcode_formats), 'attr') : [],
						'multiple' => 'multiple',
						'data-role' => 'tagsinput']) ?>
				</div>
			</div>```

Epic. Thanks. I'm hoping that's what is causing the null reference exception when the line 2 is the item id and the barcode type is EAN-13.

from opensourcepos.

objecttothis avatar objecttothis commented on June 16, 2024

@odiea your code change resolves the issue with the configuration. Thank you for posting that. Our bug with getting an undefined array key "" error when EAN-13 is the barcode type, barcode is an ISBN-13 number, barcode content is set to Item Id/Name and Barcode Layout set to Item Name/Barcode/Retail Price is still present.
image

When I check "Generate if Empty" the problem goes away. @odiea do you get the same behavior with the settings I listed?

from opensourcepos.

odiea avatar odiea commented on June 16, 2024

What's a good ean-13 or isbn-13 number to try. No i have not tested this yet.

from opensourcepos.

odiea avatar odiea commented on June 16, 2024

Is this what you are looking for? No errors show not even in error log.
2024-02-27 13_35_19-Open Source Point of Sale _ Powered by OSPOS 3 4 0-dev
2024-02-27 13_36_02-Generate Barcodes
This is if I change to barcode instead of item_id
2024-02-27 13_38_20-Generate Barcodes

from opensourcepos.

objecttothis avatar objecttothis commented on June 16, 2024

I'm using 9780230766518 for the value of item_number (the barcode) on an item that isn't generating but throwing the exception. The thing I find interesting is that the barcode content is set to Item Id/Name, so it shouldn't matter what the Barcode value is.

from opensourcepos.

objecttothis avatar objecttothis commented on June 16, 2024

Here's the exact error and stack trace
Caught exception: Undefined array key ""
Stack trace:
#0 \app\Libraries\Barcodes\Ean13.php(277): CodeIgniter\Debug\Exceptions->errorHandler(2, 'Undefined array...', 'C:\Users\objec\...', 277)
#1 \app\Libraries\Barcode_lib.php(157): App\Libraries\Barcodes\Ean13->draw()
#2 \app\Libraries\Barcode_lib.php(214): App\Libraries\Barcode_lib->generate_barcode(Array, Array)
#3 \app\Views\barcodes\barcode_sheet.php(34): App\Libraries\Barcode_lib->display_barcode(Array, Array)
#4 \vendor\codeigniter4\framework\system\View\View.php(228): include('C:\Users\objec\...')
#5 \vendor\codeigniter4\framework\system\View\View.php(231): CodeIgniter\View\View->CodeIgniter\View{closure}()
#6 \vendor\codeigniter4\framework\system\Common.php(1178): CodeIgniter\View\View->render('barcodes/barcod...', Array, true)
#7 \app\Controllers\Items.php(521): view('barcodes/barcod...', Array)
#8 \vendor\codeigniter4\framework\system\CodeIgniter.php(941): App\Controllers\Items->getGenerateBarcodes(Array)
#9 \vendor\codeigniter4\framework\system\CodeIgniter.php(502): CodeIgniter\CodeIgniter->runController(Object(App\Controllers\Items))
#10 \vendor\codeigniter4\framework\system\CodeIgniter.php(361): CodeIgniter\CodeIgniter->handleRequest(NULL, Object(Config\Cache), false)
#11 \public\index.php(79): CodeIgniter\CodeIgniter->run()
#12 {main}

from opensourcepos.

odiea avatar odiea commented on June 16, 2024

Yes I also have that issue with this barcode
ISBN 9780230766518 EDIT PRODUCT
The $100 Startup: Fire Your Boss, Do What You Love and Work Better to Live More
(Write a Review)
Barcode Formats: ISBN-10 023076651X, ISBN-13 9780230766518
Category: Media > Books
Author: Guillebeau, Chris

from opensourcepos.

odiea avatar odiea commented on June 16, 2024

It doesn't show the issue when I change it to EAN 8

from opensourcepos.

objecttothis avatar objecttothis commented on June 16, 2024

The place that it's dying is in this for loop

		for ($idx = 1; $idx < 7; ++$idx)
		{
			$value = substr($this->data, $idx, 1);

			if(isset($this->_codingmap[$value][$set_array[$idx - 1]]))
			{
    			foreach($this->_codingmap[$value][$set_array[$idx - 1]] as $bar)
				{
        			if($bar)
					{
						imagefilledrectangle(
							$this->img,
							$xpos,
							0,
							$xpos + $pxPerBar - 1,
							$this->y,
							$black
						);
					}
        			$xpos += $pxPerBar;
    			}
			}
			else
			{
    			throw new \Exception("Invalid index in _codingmap array. Value: $value, Set: {$set_array[$idx - 1]}");
			}
		}

It's trying to access an array element 5 but the item id 13228 only has 0-4

from opensourcepos.

objecttothis avatar objecttothis commented on June 16, 2024

The frustrating thing is that this is working in 3.3.9.

from opensourcepos.

odiea avatar odiea commented on June 16, 2024

I understand your pain. Sendmail also does not work depending on the php version or Apache version.

from opensourcepos.

objecttothis avatar objecttothis commented on June 16, 2024

I understand your pain. Sendmail also does not work depending on the php version or Apache version.

That reminds me. The mixed type hint for function parameters wasn't introduced until PHP 8.0 so we need to find any instances of it in the code and remove them because they will break PHP 7.4 user's applications.

from opensourcepos.

odiea avatar odiea commented on June 16, 2024

CRITICAL - 2024-02-27 15:46:47 --> Argument 1 passed to App\Libraries\Barcodes\Ean13::setData() must be an instance of App\Libraries\Barcodes\mixed, string given, called in C:\newwamp\www\ospos\app\Libraries\Barcode_lib.php on line 80
in APPPATH\Libraries\Barcodes\Ean13.php on line 125.
1 APPPATH\Libraries\Barcode_lib.php(80): App\Libraries\Barcodes\Ean13->setData('2')
2 APPPATH\Libraries\Barcode_lib.php(149): App\Libraries\Barcode_lib::barcode_instance([...], [...])
3 APPPATH\Libraries\Barcode_lib.php(205): App\Libraries\Barcode_lib->generate_barcode([...], [...])
4 APPPATH\Views\barcodes\barcode_sheet.php(34): App\Libraries\Barcode_lib->display_barcode([...], [...])
5 SYSTEMPATH\View\View.php(228): include('C:\newwamp\www\ospos\app\Views\barcodes\barcode_sheet.php')
6 SYSTEMPATH\View\View.php(231): CodeIgniter\View\View->CodeIgniter\View{closure}()
7 SYSTEMPATH\Common.php(1190): CodeIgniter\View\View->render('barcodes/barcode_sheet', [], true)
8 APPPATH\Controllers\Items.php(520): view('barcodes/barcode_sheet', [...])
9 SYSTEMPATH\CodeIgniter.php(942): App\Controllers\Items->getGenerateBarcodes([...])
10 SYSTEMPATH\CodeIgniter.php(502): CodeIgniter\CodeIgniter->runController(Object(App\Controllers\Items))
11 SYSTEMPATH\CodeIgniter.php(361): CodeIgniter\CodeIgniter->handleRequest(null, Object(Config\Cache), false)
12 FCPATH\index.php(79): CodeIgniter\CodeIgniter->run()

from opensourcepos.

objecttothis avatar objecttothis commented on June 16, 2024

Exactly. Just take the mixed type hint out and it will work. We need to do a code search for other places with mixed in there.

from opensourcepos.

odiea avatar odiea commented on June 16, 2024

I changed the location of the $value and it is not givng me the error now. But does it give a correct ean13 for you

$value = substr($this->data, $idx, 1);
		for ($idx = 1; $idx < 7; ++$idx)
		{
			//$value = substr($this->data, $idx, 1);
			foreach ($this->_codingmap[$value][$set_array[$idx - 1]] as $bar)
			{
				if ($bar)
				{
					imagefilledrectangle(
						$this->img,
						$xpos,
						0,
						$xpos + $pxPerBar - 1,
						$this->y,
						$black
					);
				}

				$xpos += $pxPerBar;
			}
		}

from opensourcepos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.