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

(-)a/installer/data/mysql/atomicupdate/bug_38207-add-vendor-payment-method.pl (+41 lines)
Line 0 Link Here
1
use Modern::Perl;
2
use Koha::Installer::Output qw(say_warning say_failure say_success say_info);
3
4
return {
5
    bug_number  => "38207",
6
    description => "Add a payment method to the vendor table",
7
    up          => sub {
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
10
11
        unless ( column_exists( 'aqbooksellers', 'payment_method' ) ) {
12
            $dbh->do(
13
                q{
14
                    ALTER TABLE aqbooksellers
15
                        ADD COLUMN `payment_method` varchar(255) NULL DEFAULT NULL
16
                        COMMENT 'the payment method for the vendor'
17
                        AFTER external_id
18
            }
19
            );
20
21
            say $out "Added new column 'aqbooksellers.payment_method'";
22
        }
23
24
        $dbh->do(
25
            q{
26
            INSERT IGNORE INTO authorised_value_categories( category_name, is_system ) VALUES ('VENDOR_PAYMENT_METHOD', 1);
27
        }
28
        );
29
        say $out "Added VENDOR_PAYMENT_METHOD authorised value category";
30
31
        $dbh->do(
32
            q{
33
            INSERT IGNORE INTO authorised_values (category, authorised_value, lib)
34
            VALUES
35
                ('VENDOR_PAYMENT_METHOD', 'card', 'Card'),
36
                ('VENDOR_PAYMENT_METHOD', 'bacs', 'BACS');
37
        }
38
        );
39
        say $out "Added Card and BACS to VENDOR_PAYMENT_METHODS authorised value category";
40
    },
41
};
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 502-507 CREATE TABLE `aqbooksellers` ( Link Here
502
  `fax` varchar(50) DEFAULT NULL COMMENT 'vendor fax number',
502
  `fax` varchar(50) DEFAULT NULL COMMENT 'vendor fax number',
503
  `deliverytime` int(11) DEFAULT NULL COMMENT 'vendor delivery time',
503
  `deliverytime` int(11) DEFAULT NULL COMMENT 'vendor delivery time',
504
  `external_id` varchar(255) DEFAULT NULL COMMENT 'external id of the vendor',
504
  `external_id` varchar(255) DEFAULT NULL COMMENT 'external id of the vendor',
505
  `payment_method` varchar(255) DEFAULT NULL COMMENT 'the payment method for the vendor',
505
  PRIMARY KEY (`id`),
506
  PRIMARY KEY (`id`),
506
  KEY `listprice` (`listprice`),
507
  KEY `listprice` (`listprice`),
507
  KEY `invoiceprice` (`invoiceprice`),
508
  KEY `invoiceprice` (`invoiceprice`),
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorFormAdd.vue (-1 / +9 lines)
Lines 89-94 export default { Link Here
89
                    vendor.address3 && (physical += vendor.address3 + "\n")
89
                    vendor.address3 && (physical += vendor.address3 + "\n")
90
                    vendor.address4 && (physical += vendor.address4 + "\n")
90
                    vendor.address4 && (physical += vendor.address4 + "\n")
91
                    this.vendor.physical = physical
91
                    this.vendor.physical = physical
92
                    this.vendor.payment_method = vendor.payment_method
93
                        ? vendor.payment_method.split("|")
94
                        : []
92
                    this.initialized = true
95
                    this.initialized = true
93
                },
96
                },
94
                error => {}
97
                error => {}
Lines 123-128 export default { Link Here
123
                    requiredProperties
126
                    requiredProperties
124
            )
127
            )
125
128
129
            if (vendor.payment_method && vendor.payment_method.length > 0) {
130
                vendor.payment_method = vendor.payment_method.join("|")
131
            } else {
132
                vendor.payment_method = null
133
            }
134
126
            const client = APIClient.acquisition
135
            const client = APIClient.acquisition
127
            if (vendorId) {
136
            if (vendorId) {
128
                client.vendors.update(vendor, vendorId).then(
137
                client.vendors.update(vendor, vendorId).then(
129
- 

Return to bug 38207