3 # Copyright 2012, 2014 Mark Gavillet & PTFS Europe Ltd
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # Koha is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with Koha; if not, see <http://www.gnu.org/licenses>.
26 my $input = CGI
->new();
28 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
(
30 template_name
=> 'admin/edi_ean_accounts.tt',
33 flagsrequired
=> { acquisition
=> 'edi_manage' },
37 my $schema = Koha
::Database
->new()->schema();
39 my $id = scalar $input->param('id');
40 my $op = scalar $input->param('op') || 'display';
42 if ( $op eq 'ean_form' ) {
43 my $e = $schema->resultset('EdifactEan')->find($id);
44 my @branches = $schema->resultset('Branch')->search(
47 columns
=> [ 'branchcode', 'branchname' ],
48 order_by
=> 'branchname',
53 branches
=> \
@branches,
57 elsif ( $op eq 'delete_confirm' ) {
58 my $e = $schema->resultset('EdifactEan')->find($id);
65 if ( $op eq 'save' ) {
68 $schema->resultset('EdifactEan')->find($id)->update(
70 branchcode
=> scalar $input->param('branchcode') || undef,
71 description
=> scalar $input->param('description'),
72 ean
=> scalar $input->param('ean'),
73 id_code_qualifier
=> scalar $input->param('id_code_qualifier'),
78 my $new_ean = $schema->resultset('EdifactEan')->new(
80 branchcode
=> scalar $input->param('branchcode') || undef,
81 description
=> scalar $input->param('description'),
82 ean
=> scalar $input->param('ean'),
83 id_code_qualifier
=> scalar $input->param('id_code_qualifier'),
89 elsif ( $op eq 'delete_confirmed' ) {
90 my $e = $schema->resultset('EdifactEan')->find($id);
93 my @eans = $schema->resultset('EdifactEan')->search(
99 $template->param( display
=> 1 );
100 $template->param( eans
=> \
@eans );
107 description
=> 'EAN International',
111 description
=> 'US SAN Agency',
115 description
=> 'Assigned by supplier',
119 description
=> 'Assigned by buyer',
124 output_html_with_http_headers
( $input, $cookie, $template->output );