Lines 1-7
Link Here
|
1 |
use Modern::Perl; |
1 |
use Modern::Perl; |
2 |
|
2 |
|
3 |
return { |
3 |
return { |
4 |
bug_number => "30649", |
4 |
bug_number => "30649", |
5 |
description => "Increase the vendor EDI account password field to 256 characters", |
5 |
description => "Increase the vendor EDI account password field to 256 characters", |
6 |
up => sub { |
6 |
up => sub { |
7 |
my ($args) = @_; |
7 |
my ($args) = @_; |
Lines 10-25
return {
Link Here
|
10 |
ALTER TABLE vendor_edi_accounts CHANGE COLUMN `password` `password` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL |
10 |
ALTER TABLE vendor_edi_accounts CHANGE COLUMN `password` `password` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL |
11 |
}); |
11 |
}); |
12 |
|
12 |
|
13 |
require Koha::Encryption; |
13 |
my $edi_vendors = |
14 |
my $e = Koha::Encryption->new; |
14 |
$dbh->selectall_arrayref( "SELECT * FROM vendor_edit_accounts", { Slice => {} } ); |
15 |
|
15 |
if (@$edi_vendors) { |
16 |
my $schema = Koha::Database->new()->schema(); |
16 |
require Koha::Encryption; |
17 |
my $rs = $schema->resultset('VendorEdiAccount')->search(); |
17 |
my $e = Koha::Encryption->new; |
18 |
while ( my $a = $rs->next() ) { |
18 |
for my $edi_vendor (@$edi_vendors) { |
19 |
my $password = $a->password; |
19 |
my $id = $edi_vendor->{id}; |
20 |
$password = $e->encrypt_hex($password); |
20 |
my $password = $edi_vendor->{password}; |
21 |
$a->password($password); |
21 |
$password = $e->encrypt_hex($password); |
22 |
$a->update(); |
22 |
$dbh->do("UPDATE edi_vendor_accounts SET password = $password WHERE id = $id"); |
|
|
23 |
} |
23 |
} |
24 |
} |
24 |
}, |
25 |
}, |
25 |
}; |
26 |
}; |
26 |
- |
|
|