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 under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 3 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 my $input = CGI
->new();
28 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
(
30 template_name
=> 'admin/edi_ean_accounts.tt',
34 flagsrequired
=> { acquisition
=> 'edi_manage' },
38 my $schema = Koha
::Database
->new()->schema();
40 my $id = scalar $input->param('id');
41 my $op = scalar $input->param('op') || 'display';
43 if ( $op eq 'ean_form' ) {
44 my $e = $schema->resultset('EdifactEan')->find($id);
45 my @branches = $schema->resultset('Branch')->search(
48 columns
=> [ 'branchcode', 'branchname' ],
49 order_by
=> 'branchname',
54 branches
=> \
@branches,
58 elsif ( $op eq 'delete_confirm' ) {
59 my $e = $schema->resultset('EdifactEan')->find($id);
66 if ( $op eq 'save' ) {
69 $schema->resultset('EdifactEan')->find($id)->update(
71 branchcode
=> scalar $input->param('branchcode') || undef,
72 description
=> scalar $input->param('description'),
73 ean
=> scalar $input->param('ean'),
74 id_code_qualifier
=> scalar $input->param('id_code_qualifier'),
79 my $new_ean = $schema->resultset('EdifactEan')->new(
81 branchcode
=> scalar $input->param('branchcode') || undef,
82 description
=> scalar $input->param('description'),
83 ean
=> scalar $input->param('ean'),
84 id_code_qualifier
=> scalar $input->param('id_code_qualifier'),
90 elsif ( $op eq 'delete_confirmed' ) {
91 my $e = $schema->resultset('EdifactEan')->find($id);
94 my @eans = $schema->resultset('EdifactEan')->search(
100 $template->param( display
=> 1 );
101 $template->param( eans
=> \
@eans );
108 description
=> 'EAN International',
112 description
=> 'US SAN Agency',
116 description
=> 'Assigned by supplier',
120 description
=> 'Assigned by buyer',
125 output_html_with_http_headers
( $input, $cookie, $template->output );