View | Details | Raw Unified | Return to bug 12074
Collapse All | Expand All

(-)a/acqui/addorderiso2709.pl (-2 / +11 lines)
Lines 58-63 my ($template, $loggedinuser, $cookie, $userflags) = get_template_and_user({ Link Here
58
my $cgiparams = $input->Vars;
58
my $cgiparams = $input->Vars;
59
my $op = $cgiparams->{'op'};
59
my $op = $cgiparams->{'op'};
60
my $booksellerid  = $input->param('booksellerid');
60
my $booksellerid  = $input->param('booksellerid');
61
my $allmatch = $input->param('allmatch');
61
my $bookseller = GetBookSellerFromId($booksellerid);
62
my $bookseller = GetBookSellerFromId($booksellerid);
62
my $data;
63
my $data;
63
64
Lines 122-127 if ($op eq ""){ Link Here
122
    $template->param("batch_details" => 1,
123
    $template->param("batch_details" => 1,
123
                     "basketno"      => $cgiparams->{'basketno'},
124
                     "basketno"      => $cgiparams->{'basketno'},
124
                     loop_currencies  => \@loop_currency,
125
                     loop_currencies  => \@loop_currency,
126
                     "allmatch" => $allmatch,
125
                     );
127
                     );
126
    import_biblios_list($template, $cgiparams->{'import_batch_id'});
128
    import_biblios_list($template, $cgiparams->{'import_batch_id'});
127
    if ( C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber ) {
129
    if ( C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber ) {
Lines 157-170 if ($op eq ""){ Link Here
157
    # retrieve the file you want to import
159
    # retrieve the file you want to import
158
    my $import_batch_id = $cgiparams->{'import_batch_id'};
160
    my $import_batch_id = $cgiparams->{'import_batch_id'};
159
    my $biblios = GetImportRecordsRange($import_batch_id);
161
    my $biblios = GetImportRecordsRange($import_batch_id);
162
    my $duplinbatch;
163
    my $imported = 0;
160
    for my $biblio (@$biblios){
164
    for my $biblio (@$biblios){
161
        # 1st insert the biblio, or find it through matcher
165
        # 1st insert the biblio, or find it through matcher
162
        my ( $marcblob, $encoding ) = GetImportRecordMarc( $biblio->{'import_record_id'} );
166
        my ( $marcblob, $encoding ) = GetImportRecordMarc( $biblio->{'import_record_id'} );
163
        my $marcrecord = MARC::Record->new_from_usmarc($marcblob) || die "couldn't translate marc information";
167
        my $marcrecord = MARC::Record->new_from_usmarc($marcblob) || die "couldn't translate marc information";
164
        my $match = GetImportRecordMatches( $biblio->{'import_record_id'}, 1 );
168
        my $match = GetImportRecordMatches( $biblio->{'import_record_id'}, 1 );
165
        my $biblionumber=$#$match > -1?$match->[0]->{'biblionumber'}:0;
169
        my $biblionumber=$#$match > -1?$match->[0]->{'biblionumber'}:0;
166
167
        unless ( $biblionumber ) {
170
        unless ( $biblionumber ) {
171
            $duplinbatch=$import_batch_id and next if FindDuplicate($marcrecord);
168
            # add the biblio
172
            # add the biblio
169
            my $bibitemnum;
173
            my $bibitemnum;
170
174
Lines 261-269 if ($op eq ""){ Link Here
261
        } else {
265
        } else {
262
            SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' );
266
            SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' );
263
        }
267
        }
268
    $imported++;
264
    }
269
    }
265
    # go to basket page
270
    # go to basket page
266
    print $input->redirect("/cgi-bin/koha/acqui/basket.pl?basketno=".$cgiparams->{'basketno'});
271
    if ( $imported ) {
272
        print $input->redirect("/cgi-bin/koha/acqui/basket.pl?basketno=".$cgiparams->{'basketno'}."&duplinbatch=$duplinbatch");
273
    } else {
274
        print $input->redirect("/cgi-bin/koha/acqui/addorderiso2709.pl?import_batch_id=$import_batch_id&basketno=".$cgiparams->{'basketno'}."&booksellerid=$booksellerid&allmatch=1");
275
    }
267
    exit;
276
    exit;
268
}
277
}
269
278
(-)a/acqui/basket.pl (-1 / +2 lines)
Lines 68-74 the supplier this script have to display the basket. Link Here
68
my $query        = new CGI;
68
my $query        = new CGI;
69
our $basketno     = $query->param('basketno');
69
our $basketno     = $query->param('basketno');
70
my $booksellerid = $query->param('booksellerid');
70
my $booksellerid = $query->param('booksellerid');
71
71
my $duplinbatch =  $query->param('duplinbatch');
72
my ( $template, $loggedinuser, $cookie, $userflags ) = get_template_and_user(
72
my ( $template, $loggedinuser, $cookie, $userflags ) = get_template_and_user(
73
    {
73
    {
74
        template_name   => "acqui/basket.tmpl",
74
        template_name   => "acqui/basket.tmpl",
Lines 429-434 if ( $op eq 'delete_confirm' ) { Link Here
429
        grouped              => $basket->{basketgroupid},
429
        grouped              => $basket->{basketgroupid},
430
        unclosable           => @orders ? 0 : 1, 
430
        unclosable           => @orders ? 0 : 1, 
431
        has_budgets          => $has_budgets,
431
        has_budgets          => $has_budgets,
432
        duplinbatch          => $duplinbatch,
432
    );
433
    );
433
}
434
}
434
435
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt (-1 / +7 lines)
Lines 52-57 Link Here
52
   <div id="bd">
52
   <div id="bd">
53
       <div id="yui-main">
53
       <div id="yui-main">
54
           <div class="yui-b">
54
           <div class="yui-b">
55
             [% IF ( allmatch ) %]<div class="dialog alert">
56
              <h4>No records imported</h4>
57
             No record have been imported because they all match an existing record in the database.<br />You'll have to treat them individually.
58
             </div>
59
             [% END %]
60
55
             [% IF ( batch_details ) %]
61
             [% IF ( batch_details ) %]
56
                  <h1>Add orders from [% comments %]
62
                  <h1>Add orders from [% comments %]
57
                    ([% file_name %] staged on [% upload_timestamp | $KohaDates with_hours => 1 %])
63
                    ([% file_name %] staged on [% upload_timestamp | $KohaDates with_hours => 1 %])
Lines 149-155 Link Here
149
               </div>
155
               </div>
150
             [% END %]
156
             [% END %]
151
           </div>
157
           </div>
152
        [% IF ( import_batch_id ) %]
158
        [% IF ( import_batch_id && ! allmatch ) %]
153
            <div class="yui-b">
159
            <div class="yui-b">
154
            <h2>Import all</h2>
160
            <h2>Import all</h2>
155
            <p>Import all the lines in the basket with the following parameters:</p>
161
            <p>Import all the lines in the basket with the following parameters:</p>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt (-1 / +4 lines)
Lines 393-398 Link Here
393
            </div>
393
            </div>
394
            </div>
394
            </div>
395
        [% END %]
395
        [% END %]
396
        [% IF ( duplinbatch ) %]<div class="dialog alert">
397
        <h4>Duplicate warning</h4>
398
        <p>Some records have not been automatically added because they match an existing record in your catalog:<a href="/cgi-bin/koha/acqui/addorderiso2709.pl?import_batch_id=[% duplinbatch %]&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]" title="Open in new window" target="_blank" class="popup"></a></p>
399
        </div>[% END %]
396
400
397
        [% UNLESS ( delete_confirm ) %]
401
        [% UNLESS ( delete_confirm ) %]
398
        <div id="acqui_basket_content" class="yui-g">
402
        <div id="acqui_basket_content" class="yui-g">
399
- 

Return to bug 12074