[ic] There was an error adding the order to the transaction table. It was: Not a GLOB reference at /opt/interchange-master/lib/Vend/Table/Common.pm line 1080.

Gert van der Spoel gert at 3edge.com
Sun Apr 1 20:41:09 UTC 2018


> On 03/30/2018 10:04 AM, Gert van der Spoel wrote:
> >> On 03/26/2018 11:36 PM, Gert van der Spoel wrote:
> >>> Hi,
> >>>
> >>>
> >>>
> >>> I’m trying to run an Interchange site using interchange-master and
> >>> I’m
> >> running into issues trying to make an order.
> >>>
> >>> The site is using a pretty standard etc/log_transaction file.
> >>>
> >>> Finalizing the order results in the following error:
> >>>
> >>> “There was an error adding the order to the transaction table. It was:
> >>> Not a GLOB reference at /opt/interchange-
> >> master/lib/Vend/Table/Common.pm line 1080.”
> >>>
> >>>
> >>>
> >>> This happens for transaction and orderline tables.
> >>>
> >>>
> >>>
> >>> Now if I change the lib/VendTable/Common.pm with the following diff
> >>> then
> >> it does pass:
> >>>
> >>> 1080c1080
> >>>
> >>> <                                             open(IN, "+<",
> >>> \$infile)
> >>>
> >>> ---
> >>>
> >>>>                                             open(IN, '+<', $infile)
> >>>
> >>>
> >>>
> >>> For reference:
> >>> https://github.com/interchange/interchange/blob/master/lib/Vend/Tabl
> >>> e/
> >>> Common.pm
> >>>
> >>>
> >>>
> >>> I don’t know if this has anything to do with the newer Perl version
> >>> or that there is some other glitch somewhere. As I’ve kinda been out
> >>> of Perl for the past 10 years, I hope someone here with more recent
> >>> Perl
> >> experience could shine a light on this.
> >>>
> >>>
> >>>
> >>> Now after making this change it does pass, but then I end up with
> >>> the
> > next
> >> error:
> >>>
> >>> “import into orderline failed: DBD::mysql::st execute failed: Column
> >>> \'store_id\' cannot be null at /opt/interchange-
> >> master/lib/Vend/Table/DBI.pm line 1593, <IN> chunk 2.”
> >>>
> >>
> >> Hello Gert,
> >>
> >> looks like you don't set a value for store_id in your [import] block.
> > [import]
> >> behaves pretty stupid as it tries to set fields even if you don't
> >> pass
> > them inside.
> >>
> >> Regards
> >>           Racke
> >
> >
> > Hi Stefan,
> >
> > Thanks for checking!
> > I also thought at first that this was the problem, even though (like
> > in the strap/standard demos) the store_id is set as:
> > store_id: __STORE_ID__
> >
> > Even without the STORE_ID Variable it should not be null, just empty.
> >
> > I think the base of the problem already lies in the lib/Vend/Common.pm ...
> > Aparently you all can use the code 'as is', but in my case I need to
> > change line 1080 ... I am only not so sure what's the big difference
> > between using \$infile instead of $infile and what could cause it to
> > crash for me, but not for yours/Jon's ... Do you have any thoughts on that?
> 
> Hello Gert,
> 
> my thoughts are that these import routines in Interchange are opaque,
> complex and hard to tackle.
> 
> You could try wellwell's [import-lite] tag:
> 
> https://github.com/interchange/wellwell/blob/master/code/import_lite.tag
> 

Hi Stefan,

Well with import_lite.tag it looks like things work, so thanks for that. A bit scary to be honest, but I am willing to take the chance as I've not much time to keep diving into finding solutions ... 

Also the admin has been causing me issues where it did not want to make updates using the Item Editor ... 

The issue turned out to be in this code in lib/Vend/Data.pm:
https://github.com/interchange/interchange/blob/master/lib/Vend/Data.pm
(starting at line 2290):
			my $k = $multikey ? undef : $key;
			my $args = [$dml, $k];
			for (keys %$qd) {
				$qret = $qd->{$_}->set_slice($args, $qf->{$_}, $qv->{$_});
				$rows_set[$i] ||= $qret;
}

It has to do a couple of 'set_slice' calls in the for loop ... But after the first set_slice the $args value changed to an empty array.

I then changed my code to:
			my $k = $multikey ? undef : $key;
			my $args = [];
			for (keys %$qd) {
				$args = [$dml, $k];
				$qret = $qd->{$_}->set_slice($args, $qf->{$_}, $qv->{$_});
				$rows_set[$i] ||= $qret;
}

And this solved my problem and data was updated correctly for all queries in the for loop ... Maybe this will help someone in the future when trying to install latest Interchange on a very new Perl and Debian install ... 

CU,

Gert





> >
> > Thanks!
> >
> > Gert
> >
> >
> >
> >>>
> >>>
> >>> This seems to be because the following set_row code is not passing
> >>> on
> > the
> >> correct data:
> >>>
> >>>      NOTES => <<EndOfRoutine,
> >>>
> >>>         while (<IN>) {
> >>>
> >>>             chomp;
> >>>
> >>>                 \@fields = ();
> >>>
> >>>                 s/\\r?\\n\\r?\\n((?s:.)*)//
> >>>
> >>>                      and \$fields[$idx] = \$1;
> >>>
> >>>                 while(s!($codere):[ \\t]*(.*)\\n?!!) {
> >>>
> >>>                      next unless defined \$field_hash->{\$1};
> >>>
> >>>                      \$fields[\$field_hash->{\$1}] = \$2;
> >>>
> >>>                 }
> >>>
> >>>                 $index
> >>>
> >>>                 $numeric_guess
> >>>
> >>>             \$out->set_row(\@fields);
> >>>
> >>>                 $numeric_clean
> >>>
> >>>         }
> >>>
> >>>
> >>>
> >>> Does anybody have any good ideas/pointers why this might be happening?
> >>>
> >
> >
> > _______________________________________________
> > interchange-users mailing list
> > interchange-users at icdevgroup.org
> > http://www.icdevgroup.org/mailman/listinfo/interchange-users
> >
> 
> 
> --
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
> 
> _______________________________________________
> interchange-users mailing list
> interchange-users at icdevgroup.org
> http://www.icdevgroup.org/mailman/listinfo/interchange-users




More information about the interchange-users mailing list