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

(-)a/acqui/basket.pl (-1 / +1 lines)
Lines 430-436 if ( $op eq 'list' ) { Link Here
430
        unclosable           => @orders ? $basket->{is_standing} : 1,
430
        unclosable           => @orders ? $basket->{is_standing} : 1,
431
        has_budgets          => $has_budgets,
431
        has_budgets          => $has_budgets,
432
        duplinbatch          => $duplinbatch,
432
        duplinbatch          => $duplinbatch,
433
        csv_profiles         => [ Koha::CsvProfiles->search({ type => 'export_basket' }) ],
433
        csv_profiles         => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'export_basket' }) ],
434
    );
434
    );
435
}
435
}
436
436
(-)a/basket/basket.pl (-1 / +1 lines)
Lines 122-128 my $resultsarray = \@results; Link Here
122
122
123
$template->param(
123
$template->param(
124
    BIBLIO_RESULTS => $resultsarray,
124
    BIBLIO_RESULTS => $resultsarray,
125
    csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ],
125
    csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ],
126
    bib_list => $bib_list,
126
    bib_list => $bib_list,
127
);
127
);
128
128
(-)a/basket/downloadcart.pl (-1 / +1 lines)
Lines 90-96 if ($bib_list && $format) { Link Here
90
    print $output;
90
    print $output;
91
91
92
} else { 
92
} else { 
93
    $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]);
93
    $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]);
94
    $template->param(bib_list => $bib_list); 
94
    $template->param(bib_list => $bib_list); 
95
    output_html_with_http_headers $query, $cookie, $template->output;
95
    output_html_with_http_headers $query, $cookie, $template->output;
96
}
96
}
(-)a/installer/data/mysql/atomicupdate/bug_8612.sql (-1 / +4 lines)
Line 1 Link Here
1
UPDATE export_format SET type = 'late_issues' WHERE type ='sql';
1
ALTER TABLE export_format ADD used_for varchar(255) DEFAULT 'export_records' AFTER type;
2
3
UPDATE export_format SET used_for = 'late_issues' WHERE type = 'sql';
4
UPDATE export_format SET used_for = 'export_records' WHERE type = 'marc';
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 711-716 CREATE TABLE `export_format` ( Link Here
711
  `subfield_separator` varchar(2) NOT NULL,
711
  `subfield_separator` varchar(2) NOT NULL,
712
  `encoding` varchar(255) NOT NULL,
712
  `encoding` varchar(255) NOT NULL,
713
  `type` varchar(255) DEFAULT 'marc',
713
  `type` varchar(255) DEFAULT 'marc',
714
  `usage` varchar(255) DEFAULT 'export_records',
714
  PRIMARY KEY  (`export_format_id`)
715
  PRIMARY KEY  (`export_format_id`)
715
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Used for CSV export';
716
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Used for CSV export';
716
717
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt (-4 / +37 lines)
Lines 102-114 function reloadPage(p) { Link Here
102
[% END %]
102
[% END %]
103
103
104
[% BLOCK type_description %]
104
[% BLOCK type_description %]
105
    [% IF type_code == 'marc' %] MARC for export records
105
    [% IF type_code == 'marc' %] MARC
106
    [% ELSIF type_code == 'late_issues' %] SQL for late serial issues claims
106
    [% ELSIF type_code == 'sql' %] SQL
107
    [% ELSIF type_code == 'export_basket' %] SQL for basket export in acquisition
108
    [% ELSE %] Uknown type
107
    [% ELSE %] Uknown type
109
    [% END %]
108
    [% END %]
110
[% END %]
109
[% END %]
111
110
111
[% BLOCK used_for_description %]
112
    [% IF used_for_code == 'export_records' %] Export records
113
    [% ELSIF used_for_code == 'late_issues' %] Late serial issues claims
114
    [% ELSIF used_for_code == 'export_basket' %] Basket export in acquisition
115
    [% ELSE %] Uknown usage
116
    [% END %]
117
[% END %]
118
112
[% IF op == 'add_form' %]
119
[% IF op == 'add_form' %]
113
    [% IF csv_profile %]
120
    [% IF csv_profile %]
114
        <h1>Modify a CSV profile</h1>
121
        <h1>Modify a CSV profile</h1>
Lines 132-138 function reloadPage(p) { Link Here
132
                <li>
139
                <li>
133
                    <label for="type" class="required">Profile type: </label>
140
                    <label for="type" class="required">Profile type: </label>
134
                    <select id="type" name="type">
141
                    <select id="type" name="type">
135
                        [% FOREACH type IN [ 'marc' 'late_issues' 'export_basket'] %]
142
                        [% FOREACH type IN [ 'marc' 'sql'] %]
136
                        [% IF csv_profile.type == type %]
143
                        [% IF csv_profile.type == type %]
137
                            <option value="[% type %]" selected="selected">[% PROCESS type_description type_code = type %]</option>
144
                            <option value="[% type %]" selected="selected">[% PROCESS type_description type_code = type %]</option>
138
                        [% ELSE %]
145
                        [% ELSE %]
Lines 142-147 function reloadPage(p) { Link Here
142
                    </select>
149
                    </select>
143
                    <span class="required">Required</span>
150
                    <span class="required">Required</span>
144
                </li>
151
                </li>
152
                <li class="sql_specific">
153
                    <label for="used_for_sql">Usage: </label>
154
                    <select id="used_for_sql" name="used_for_sql">
155
                        [% FOREACH used_for IN [ 'late_issues' 'export_basket' ] %]
156
                        [% IF csv_profile.used_for == used_for %]
157
                            <option value="[% used_for %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option>
158
                        [% ELSE %]
159
                            <option value="[% used_for %]">[% PROCESS used_for_description used_for_code = used_for %]</option>
160
                        [% END %]
161
                        [% END %]
162
                    </select>
163
                </li>
164
                <li class="marc_specific">
165
                    <label for="used_for_marc">Usage: </label>
166
                    <select id="used_for_marc" name="used_for_marc">
167
                        [% FOREACH used_for IN [ 'export_records' ] %]
168
                        [% IF csv_profile.used_for == used_for %]
169
                            <option value="[% used_for %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option>
170
                        [% ELSE %]
171
                            <option value="[% used_for %]">[% PROCESS used_for_description used_for_code = used_for %]</option>
172
                        [% END %]
173
                        [% END %]
174
                    </select>
175
                </li>
145
                <li>
176
                <li>
146
                    <label for="description">Profile description: </label>
177
                    <label for="description">Profile description: </label>
147
                    <textarea cols="50" rows="2" name="description" id="description">[% csv_profile.description %]</textarea>
178
                    <textarea cols="50" rows="2" name="description" id="description">[% csv_profile.description %]</textarea>
Lines 242-247 function reloadPage(p) { Link Here
242
                <th>Content</th>
273
                <th>Content</th>
243
                <th>CSV separator</th>
274
                <th>CSV separator</th>
244
                <th>CSV type</th>
275
                <th>CSV type</th>
276
                <th>Usage</th>
245
                <th>&nbsp;</th>
277
                <th>&nbsp;</th>
246
                <th>&nbsp;</th>
278
                <th>&nbsp;</th>
247
            </thead>
279
            </thead>
Lines 254-259 function reloadPage(p) { Link Here
254
                    <td>[% csv_profile.content %]</td>
286
                    <td>[% csv_profile.content %]</td>
255
                    <td>[% csv_profile.csv_separator %]</td>
287
                    <td>[% csv_profile.csv_separator %]</td>
256
                    <td>[% PROCESS type_description type_code = csv_profile.type %]</td>
288
                    <td>[% PROCESS type_description type_code = csv_profile.type %]</td>
289
                    <td>[% PROCESS used_for_description used_for_code = csv_profile.used_for %]</td>
257
                    <td><a href="/cgi-bin/koha/tools/csv-profiles.pl?op=add_form&amp;export_format_id=[% csv_profile.export_format_id %]">Edit</a></td>
290
                    <td><a href="/cgi-bin/koha/tools/csv-profiles.pl?op=add_form&amp;export_format_id=[% csv_profile.export_format_id %]">Edit</a></td>
258
                    <td><a href="/cgi-bin/koha/tools/csv-profiles.pl?op=delete_confirm&amp;export_format_id=[% csv_profile.export_format_id %]">Delete</a></td>
291
                    <td><a href="/cgi-bin/koha/tools/csv-profiles.pl?op=delete_confirm&amp;export_format_id=[% csv_profile.export_format_id %]">Delete</a></td>
259
                </tr>
292
                </tr>
(-)a/opac/opac-downloadcart.pl (-1 / +1 lines)
Lines 111-117 if ($bib_list && $format) { Link Here
111
    print $output;
111
    print $output;
112
112
113
} else { 
113
} else { 
114
    $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]);
114
    $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]);
115
    $template->param(bib_list => $bib_list); 
115
    $template->param(bib_list => $bib_list); 
116
    output_html_with_http_headers $query, $cookie, $template->output;
116
    output_html_with_http_headers $query, $cookie, $template->output;
117
}
117
}
(-)a/opac/opac-downloadshelf.pl (-1 / +1 lines)
Lines 129-135 if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { Link Here
129
        } else {
129
        } else {
130
            $template->param(fullpage => 1);
130
            $template->param(fullpage => 1);
131
        }
131
        }
132
        $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]);
132
        $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]);
133
        $template->param( shelf => $shelf );
133
        $template->param( shelf => $shelf );
134
        output_html_with_http_headers $query, $cookie, $template->output;
134
        output_html_with_http_headers $query, $cookie, $template->output;
135
    }
135
    }
(-)a/serials/claims.pl (-1 / +1 lines)
Lines 104-110 $template->param( Link Here
104
        supplierid => $supplierid,
104
        supplierid => $supplierid,
105
        claimletter => $claimletter,
105
        claimletter => $claimletter,
106
        additional_fields_for_subscription => $additional_fields,
106
        additional_fields_for_subscription => $additional_fields,
107
        csv_profiles => [ Koha::CsvProfiles->search({ type => 'late_issues' }) ],
107
        csv_profiles => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'late_issues' }) ],
108
        letters => $letters,
108
        letters => $letters,
109
        (uc(C4::Context->preference("marcflavour"))) => 1
109
        (uc(C4::Context->preference("marcflavour"))) => 1
110
        );
110
        );
(-)a/t/db_dependent/Koha/CsvProfiles.t (-2 / +3 lines)
Lines 35-46 my $nb_of_csv_profiles = Koha::CsvProfiles->search->count; Link Here
35
my $new_csv_profile_1 = Koha::CsvProfile->new({
35
my $new_csv_profile_1 = Koha::CsvProfile->new({
36
    profile => 'my_csv_profile_name_for_test_1',
36
    profile => 'my_csv_profile_name_for_test_1',
37
    description => 'my_csv_profile_description_for_test_1',
37
    description => 'my_csv_profile_description_for_test_1',
38
    type => 'late_issues'
38
    type => 'sql',
39
    used_for => 'late_issues'
39
})->store;
40
})->store;
40
my $new_csv_profile_2 = Koha::CsvProfile->new({
41
my $new_csv_profile_2 = Koha::CsvProfile->new({
41
    profile => 'my_csv_profile_name_for_test_2',
42
    profile => 'my_csv_profile_name_for_test_2',
42
    description => 'my_csv_profile_description_for_test_2',
43
    description => 'my_csv_profile_description_for_test_2',
43
    type => 'marc',
44
    type => 'marc'
44
})->store;
45
})->store;
45
46
46
like( $new_csv_profile_1->export_format_id, qr|^\d+$|, 'Adding a new csv_profile should have set the export_format_id');
47
like( $new_csv_profile_1->export_format_id, qr|^\d+$|, 'Adding a new csv_profile should have set the export_format_id');
(-)a/tools/csv-profiles.pl (+6 lines)
Lines 72-77 if ( $op eq 'add_form' ) { Link Here
72
    my $profile     = $input->param("profile");
72
    my $profile     = $input->param("profile");
73
    my $description = $input->param("description");
73
    my $description = $input->param("description");
74
    my $type        = $input->param("type");
74
    my $type        = $input->param("type");
75
    my $used_for    =
76
        $type eq "marc"
77
      ? $input->param("used_for_marc")
78
      : $input->param("used_for_sql");
75
    my $content =
79
    my $content =
76
        $type eq "marc"
80
        $type eq "marc"
77
      ? $input->param("marc_content")
81
      ? $input->param("marc_content")
Lines 92-97 if ( $op eq 'add_form' ) { Link Here
92
        $csv_profile->subfield_separator($subfield_separator);
96
        $csv_profile->subfield_separator($subfield_separator);
93
        $csv_profile->encoding($encoding);
97
        $csv_profile->encoding($encoding);
94
        $csv_profile->type($type);
98
        $csv_profile->type($type);
99
        $csv_profile->used_for($used_for);
95
        eval { $csv_profile->store; };
100
        eval { $csv_profile->store; };
96
101
97
        if ($@) {
102
        if ($@) {
Lines 109-114 if ( $op eq 'add_form' ) { Link Here
109
                subfield_separator => $subfield_separator,
114
                subfield_separator => $subfield_separator,
110
                encoding           => $encoding,
115
                encoding           => $encoding,
111
                type               => $type,
116
                type               => $type,
117
                used_for           => $used_for,
112
            }
118
            }
113
        );
119
        );
114
        eval { $csv_profile->store; };
120
        eval { $csv_profile->store; };
(-)a/tools/export.pl (-1 / +1 lines)
Lines 312-318 else { Link Here
312
        itemtypeloop             => \@itemtypesloop,
312
        itemtypeloop             => \@itemtypesloop,
313
        authority_types          => $authority_types,
313
        authority_types          => $authority_types,
314
        export_remove_fields     => C4::Context->preference("ExportRemoveFields"),
314
        export_remove_fields     => C4::Context->preference("ExportRemoveFields"),
315
        csv_profiles             => [ Koha::CsvProfiles->search({ type => 'marc' }) ],
315
        csv_profiles             => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ],
316
        messages                 => \@messages,
316
        messages                 => \@messages,
317
    );
317
    );
318
318
(-)a/virtualshelves/downloadshelf.pl (-1 / +1 lines)
Lines 101-107 if ($shelfid && $format) { Link Here
101
    }
101
    }
102
}
102
}
103
else {
103
else {
104
    $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]);
104
    $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]);
105
    $template->param(shelfid => $shelfid); 
105
    $template->param(shelfid => $shelfid); 
106
}
106
}
107
$template->param( messages => \@messages );
107
$template->param( messages => \@messages );
(-)a/virtualshelves/shelves.pl (-2 / +1 lines)
Lines 324-330 $template->param( Link Here
324
    messages => \@messages,
324
    messages => \@messages,
325
    category => $category,
325
    category => $category,
326
    print    => scalar $query->param('print') || 0,
326
    print    => scalar $query->param('print') || 0,
327
    csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ],
327
    csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ],
328
);
328
);
329
329
330
output_html_with_http_headers $query, $cookie, $template->output;
330
output_html_with_http_headers $query, $cookie, $template->output;
331
- 

Return to bug 8612