From 0fb537295ef4b2557c6348222d603c9e37581af2 Mon Sep 17 00:00:00 2001
From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Date: Thu, 28 Jul 2016 10:29:18 +0200
Subject: [PATCH] Bug 16365: Adding additional unsafe call-candidates from
 Acquisition

[1] Candidate 1 is FillWithDefaultValues.
This routine in Acquisition.pm does not autovivify the tagslib
structure but first collects the keys at tag and subfield level.
So, unsafe can be safely added here :)

[2] Candidate 2 is script acqui/neworderempty.pl.
It only (!) uses GetMarcStructure to know if there is a ACQ framework.
There should be cheaper ways to do it, but when we use the fast cache,
it does not matter that much anymore.

[3] Candidate 3 is script acqui/orderreceive.pl. Same reason as [2].

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
---
 C4/Acquisition.pm      | 2 +-
 acqui/neworderempty.pl | 2 +-
 acqui/orderreceive.pl  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm
index 6894cb4..a696b7d 100644
--- a/C4/Acquisition.pm
+++ b/C4/Acquisition.pm
@@ -3001,7 +3001,7 @@ If the field does not exist, it will be created too.
 
 sub FillWithDefaultValues {
     my ($record) = @_;
-    my $tagslib = C4::Biblio::GetMarcStructure( 1, 'ACQ' );
+    my $tagslib = C4::Biblio::GetMarcStructure( 1, 'ACQ', { unsafe => 1 } );
     if ($tagslib) {
         my ($itemfield) =
           C4::Biblio::GetMarcFromKohaField( 'items.itemnumber', '' );
diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl
index da5acd5..a4134da 100755
--- a/acqui/neworderempty.pl
+++ b/acqui/neworderempty.pl
@@ -265,7 +265,7 @@ $template->param( sort2 => $data->{'sort2'} );
 
 if (C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber) {
     # Check if ACQ framework exists
-    my $marc = GetMarcStructure(1, 'ACQ');
+    my $marc = GetMarcStructure(1, 'ACQ', { unsafe => 1 } );
     unless($marc) {
         $template->param('NoACQframework' => 1);
     }
diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl
index a75a624..402d566 100755
--- a/acqui/orderreceive.pl
+++ b/acqui/orderreceive.pl
@@ -112,7 +112,7 @@ unless ( $results and @$results) {
 my $order = $results->[0];
 
 # Check if ACQ framework exists
-my $acq_fw = GetMarcStructure(1, 'ACQ');
+my $acq_fw = GetMarcStructure( 1, 'ACQ', { unsafe => 1 } );
 unless($acq_fw) {
     $template->param('NoACQframework' => 1);
 }
-- 
2.8.1