Bug 24151: Add items.homebranch to the list

Signed-off-by: Signed-off-by: Sonia Bouis <sonia.bouis@univ-lyon3.fr>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2020-03-17 17:36:05 +01:00
parent d2731c1576
commit aa0b8cb96a
5 changed files with 11 additions and 3 deletions

View file

@ -53,6 +53,9 @@ sub new_from_statistic {
if ( grep { $_ eq 'holdingbranch' } @t_fields_to_copy ) {
$values->{holdingbranch} = $statistic->item->holdingbranch;
}
if ( grep { $_ eq 'homebranch' } @t_fields_to_copy ) {
$values->{homebranch} = $statistic->item->homebranch;
}
if ( grep { $_ eq 'transaction_type' } @t_fields_to_copy ) {
$values->{transaction_type} = $statistic->type;
}
@ -64,6 +67,7 @@ sub new_from_statistic {
@t_fields_to_copy = grep {
$_ ne 'transaction_branchcode'
&& $_ ne 'holdingbranch'
&& $_ ne 'homebranch'
&& $_ ne 'transaction_type'
&& $_ ne 'itemcallnumber'
} @t_fields_to_copy;

View file

@ -23,6 +23,7 @@ if( CheckVersion( $DBversion ) ) {
`itemnumber` int(11) default NULL,
`itemtype` varchar(10) default NULL,
`holdingbranch` varchar(10) default null,
`homebranch` varchar(10) default null,
`location` varchar(80) default NULL,
`itemcallnumber` varchar(255) default NULL,
`ccode` varchar(80) default NULL,
@ -44,7 +45,7 @@ if( CheckVersion( $DBversion ) ) {
|);
$dbh->do(q|
INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type)
VALUES ('PseudonymizationTransactionFields','','datetime,transaction_branchcode,transaction_type,itemnumber,itemtype,holdingbranch,location,itemcallnumber,ccode','Transaction fields to copy to the pseudonymized_transactions table','multiple')
VALUES ('PseudonymizationTransactionFields','','datetime,transaction_branchcode,transaction_type,itemnumber,itemtype,holdingbranch,homebranch,location,itemcallnumber,ccode','Transaction fields to copy to the pseudonymized_transactions table','multiple')
|);
unless( TableExists( 'pseudonymized_borrower_attributes' ) ) {

View file

@ -1907,6 +1907,7 @@ CREATE TABLE `pseudonymized_transactions` (
`itemnumber` int(11) default NULL,
`itemtype` varchar(10) default NULL,
`holdingbranch` varchar(10) default null,
`homebranch` varchar(10) default null,
`location` varchar(80) default NULL,
`itemcallnumber` varchar(255) default NULL,
`ccode` varchar(80) default NULL,

View file

@ -351,6 +351,7 @@ Patrons:
itemnumber: "Itemnumber"
itemtype: "Item type"
holdingbranch: "Holding branch"
homebranch: "Home branch"
location: "Location"
itemcallnumber: "Item's callnumber"
ccode: "Collection code"

View file

@ -73,7 +73,7 @@ subtest 'Config does not exist' => sub {
subtest 'Koha::Anonymized::Transactions tests' => sub {
plan tests => 11;
plan tests => 12;
$schema->storage->txn_begin;
@ -92,7 +92,7 @@ subtest 'Koha::Anonymized::Transactions tests' => sub {
'No pseudonymized transaction if Pseudonymization is off' );
t::lib::Mocks::mock_preference( 'Pseudonymization', 1 );
t::lib::Mocks::mock_preference( 'PseudonymizationTransactionFields', 'datetime,transaction_branchcode,transaction_type,itemnumber,itemtype,holdingbranch,location,itemcallnumber,ccode'
t::lib::Mocks::mock_preference( 'PseudonymizationTransactionFields', 'datetime,transaction_branchcode,transaction_type,itemnumber,itemtype,holdingbranch,homebranch,location,itemcallnumber,ccode'
);
$item = $builder->build_sample_item;
t::lib::Mocks::mock_userenv({ branchcode => $item->homebranch });
@ -108,6 +108,7 @@ subtest 'Koha::Anonymized::Transactions tests' => sub {
is( $pseudonymized->itemnumber, $item->itemnumber );
is( $pseudonymized->itemtype, $item->effective_itemtype );
is( $pseudonymized->holdingbranch, $item->holdingbranch );
is( $pseudonymized->homebranch, $item->homebranch );
is( $pseudonymized->location, $item->location );
is( $pseudonymized->itemcallnumber, $item->itemcallnumber );
is( $pseudonymized->ccode, $item->ccode );