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

(-)a/Koha/EDI.pm (+10 lines)
Lines 81-86 sub create_edi_order { Link Here
81
    my $ean_obj =
81
    my $ean_obj =
82
      $schema->resultset('EdifactEan')->search($ean_search_keys)->single;
82
      $schema->resultset('EdifactEan')->search($ean_search_keys)->single;
83
83
84
    # If no branch specific each can be found, look for a default ean
85
    unless ($ean_obj) {
86
        $ean_obj = $schema->resultset('EdifactEan')->search(
87
            {
88
                ean        => $ean,
89
                branchcode => undef,
90
            }
91
        )->single;
92
    }
93
84
    my $dbh     = C4::Context->dbh;
94
    my $dbh     = C4::Context->dbh;
85
    my $arr_ref = $dbh->selectcol_arrayref(
95
    my $arr_ref = $dbh->selectcol_arrayref(
86
'select id from edifact_messages where basketno = ? and message_type = \'QUOTE\'',
96
'select id from edifact_messages where basketno = ? and message_type = \'QUOTE\'',
(-)a/admin/edi_ean_accounts.pl (-2 / +2 lines)
Lines 68-74 else { Link Here
68
        if ($change) {
68
        if ($change) {
69
            $schema->resultset('EdifactEan')->find($id)->update(
69
            $schema->resultset('EdifactEan')->find($id)->update(
70
                {
70
                {
71
                    branchcode        => scalar $input->param('branchcode'),
71
                    branchcode        => scalar $input->param('branchcode') || undef,
72
                    description       => scalar $input->param('description'),
72
                    description       => scalar $input->param('description'),
73
                    ean               => scalar $input->param('ean'),
73
                    ean               => scalar $input->param('ean'),
74
                    id_code_qualifier => scalar $input->param('id_code_qualifier'),
74
                    id_code_qualifier => scalar $input->param('id_code_qualifier'),
Lines 78-84 else { Link Here
78
        else {
78
        else {
79
            my $new_ean = $schema->resultset('EdifactEan')->new(
79
            my $new_ean = $schema->resultset('EdifactEan')->new(
80
                {
80
                {
81
                    branchcode        => scalar $input->param('branchcode'),
81
                    branchcode        => scalar $input->param('branchcode') || undef,
82
                    description       => scalar $input->param('description'),
82
                    description       => scalar $input->param('description'),
83
                    ean               => scalar $input->param('ean'),
83
                    ean               => scalar $input->param('ean'),
84
                    id_code_qualifier => scalar $input->param('id_code_qualifier'),
84
                    id_code_qualifier => scalar $input->param('id_code_qualifier'),
(-)a/installer/data/mysql/atomicupdate/bug_21417.perl (+7 lines)
Line 0 Link Here
1
$DBversion = 'XXX';  # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do( "ALTER TABLE edifact_ean MODIFY branchcode VARCHAR(10) NULL DEFAULT NULL" );
4
5
    SetVersion( $DBversion );
6
    print "Upgrade to $DBversion done (Bug XXXXX - description)\n";
7
}
(-)a/installer/data/mysql/kohastructure.sql (-1 / +1 lines)
Lines 3735-3741 DROP TABLE IF EXISTS edifact_ean; Link Here
3735
CREATE TABLE IF NOT EXISTS edifact_ean (
3735
CREATE TABLE IF NOT EXISTS edifact_ean (
3736
  ee_id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
3736
  ee_id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
3737
  description VARCHAR(128) NULL DEFAULT NULL,
3737
  description VARCHAR(128) NULL DEFAULT NULL,
3738
  branchcode VARCHAR(10) NOT NULL REFERENCES branches (branchcode),
3738
  branchcode VARCHAR(10) NULL DEFAULT NULL REFERENCES branches (branchcode),
3739
  ean VARCHAR(15) NOT NULL,
3739
  ean VARCHAR(15) NOT NULL,
3740
  id_code_qualifier VARCHAR(3) NOT NULL DEFAULT '14',
3740
  id_code_qualifier VARCHAR(3) NOT NULL DEFAULT '14',
3741
  CONSTRAINT efk_branchcode FOREIGN KEY ( branchcode ) REFERENCES branches ( branchcode )
3741
  CONSTRAINT efk_branchcode FOREIGN KEY ( branchcode ) REFERENCES branches ( branchcode )
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/edi_ean_accounts.tt (-1 / +1 lines)
Lines 71-76 Link Here
71
          <li>
71
          <li>
72
             <label for="branchcode">Library: </label>
72
             <label for="branchcode">Library: </label>
73
             <select name="branchcode" id="branchcode">
73
             <select name="branchcode" id="branchcode">
74
                <option value="">All libraries</option>
74
                [% FOREACH branch IN branches %]
75
                [% FOREACH branch IN branches %]
75
                    [% IF branch.branchcode == ean.branch.branchcode %]
76
                    [% IF branch.branchcode == ean.branch.branchcode %]
76
                       <option value="[% branch.branchcode | html %]" selected="selected">[% branch.branchname | html %]</option>
77
                       <option value="[% branch.branchcode | html %]" selected="selected">[% branch.branchname | html %]</option>
77
- 

Return to bug 21417