package SL::BackgroundJob::SelfTest::Base;
+use strict;
+
use Test::Builder;
use parent qw(Rose::Object);
city => 75,
country => 75,
contact => 75,
- phone => 30,
fax => 30,
account_number => 15,
bank_code => 10,
my $object = $entry->{object};
- $entry->{part} = $self->parts_by->{partnumber}->{ $object->type }->{ $object->partnumber };
+ $entry->{part} = SL::DB::Manager::Part->find_by(
+ SL::DB::Manager::Part->type_filter($object->type),
+ ( partnumber => $object->partnumber ) x!! $object->partnumber,
+ );
if ($self->settings->{article_number_policy} eq 'update_prices') {
if ($entry->{part}) {
city => { type => 'varchar', length => 75 },
country => { type => 'varchar', length => 75 },
contact => { type => 'text' },
- phone => { type => 'varchar', length => 30 },
+ phone => { type => 'text' },
fax => { type => 'varchar', length => 30 },
homepage => { type => 'text' },
email => { type => 'text' },
city => { type => 'varchar', length => 75 },
country => { type => 'varchar', length => 75 },
contact => { type => 'varchar', length => 75 },
- phone => { type => 'varchar', length => 30 },
+ phone => { type => 'text' },
fax => { type => 'varchar', length => 30 },
homepage => { type => 'text' },
email => { type => 'text' },
]) unless $header;
}
+ # Special case: utf8 BOM.
+ # certain software (namely MS Office and notepad.exe insist on prefixing
+ # data with a discouraged but valid byte order mark
+ # if not removed, the first header field will not be recognized
+ if ($header && $header->[0] && $self->encoding =~ /utf-?8/i) {
+ $header->[0] =~ s/^\x{FEFF}//;
+ }
+
return unless $header;
return $self->header([ map { lc } @$header ]);
}
--- /dev/null
+-- @tag: customer_vendor_phone_no_limits
+-- @description: Keine Längenbeschränkung für Spalte phone in den Tabellen customer und vendor.
+-- @depends: release_2_7_0
+-- @charset: utf-8
+
+ALTER TABLE customer ALTER COLUMN phone TYPE text;
+ALTER TABLE vendor ALTER COLUMN phone TYPE text;
-use Test::More tests => 40;
+use Test::More tests => 41;
use lib 't';
#####
$csv = SL::Helper::Csv->new(
- file => \"Kaffee",
- header => [ 'Description' ],
- class => 'SL::DB::Part',
+file => \"Kaffee",
+header => [ 'Description' ],
+class => 'SL::DB::Part',
);
$csv->parse;
is_deeply $csv->get_data, [ { description => 'Kaffee' } ], 'case insensitive header as param works';
+#####
+
+$csv = SL::Helper::Csv->new(
+ file => \"\x{FEFF}description\nKaffee",
+ class => 'SL::DB::Part',
+ encoding => 'utf8',
+);
+$csv->parse;
+is_deeply $csv->get_data, [ { description => 'Kaffee' } ], 'utf8 BOM works (bug 1872)';
+
# vim: ft=perl
<tr>
<th align="right" nowrap>[% 'Phone' | $T8 %]</th>
- <td><input name="phone" size="30" maxlength="30" value="[% HTML.escape(phone) %]"></td>
+ <td><input name="phone" size="30" value="[% HTML.escape(phone) %]"></td>
</tr>
<tr>