Bug 28572: Remove C4::Debug
[srvgit] / tools / manage-marc-import.pl
index 892ffe8..8fcea16 100755 (executable)
@@ -17,8 +17,7 @@
 # You should have received a copy of the GNU General Public License
 # along with Koha; if not, see <http://www.gnu.org/licenses>.
 
-use strict;
-use warnings;
+use Modern::Perl;
 
 # standard or CPAN modules used
 use CGI qw ( -utf8 );
@@ -40,7 +39,7 @@ use Koha::BiblioFrameworks;
 
 my $script_name = "/cgi-bin/koha/tools/manage-marc-import.pl";
 
-my $input = new CGI;
+my $input = CGI->new;
 my $op = $input->param('op') || '';
 my $completedJobID = $input->param('completedJobID');
 our $runinbackground = $input->param('runinbackground');
@@ -54,28 +53,26 @@ my ($template, $loggedinuser, $cookie)
     = get_template_and_user({template_name => "tools/manage-marc-import.tt",
                  query => $input,
                  type => "intranet",
-                 authnotrequired => 0,
                  flagsrequired => {tools => 'manage_staged_marc'},
-                 debug => 1,
                  });
 
 my %cookies = parse CGI::Cookie($cookie);
 our $sessionID = $cookies{'CGISESSID'}->value;
 our $dbh = C4::Context->dbh;
 
-my $frameworks = Koha::BiblioFrameworks->search({}, { order_by => ['frameworktext'] });
+my $frameworks = Koha::BiblioFrameworks->search({ tagfield => { 'not' => undef } }, { join => 'marc_tag_structure', distinct => 'frameworkcode', order_by => ['frameworktext'] });
 $template->param( frameworks => $frameworks );
 
 if ($op eq "create_labels") {
        #create a batch of labels, then lose $op & $import_batch_id so we get back to import batch list.
        my $label_batch_id = create_labelbatch_from_importbatch($import_batch_id);
         if ($label_batch_id == -1) {
-            $template->param(   label_batch_msg => "Error attempting to create label batch. Please ask your system administrator to check the log for more details.",
+            $template->param(   label_batch_msg => "error",
                                 message_type    => 'alert',
             );
         }
         else {
-            $template->param(   label_batch_msg => "Label batch #$label_batch_id created.",
+            $template->param(   label_batch_msg => $label_batch_id,
                                 message_type    => 'dialog',
             );
         }
@@ -218,6 +215,7 @@ sub import_batches_list {
             comments => $batch->{'comments'},
             can_clean => ($batch->{'import_status'} ne 'cleaned') ? 1 : 0,
             record_type => $batch->{'record_type'},
+            profile => $batch->{'profile'},
         };
     }
     $template->param(batch_list => \@list); 
@@ -392,6 +390,7 @@ sub batch_info {
     my ($template, $batch) = @_;
     $template->param(batch_info => 1);
     $template->param(file_name => $batch->{'file_name'});
+    $template->param(profile => $batch->{'profile'});
     $template->param(comments => $batch->{'comments'});
     $template->param(import_status => $batch->{'import_status'});
     $template->param(upload_timestamp => $batch->{'upload_timestamp'});