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 501-506 CREATE TABLE `aqbooksellers` ( Link Here
501
  `fax` varchar(50) DEFAULT NULL COMMENT 'vendor fax number',
501
  `fax` varchar(50) DEFAULT NULL COMMENT 'vendor fax number',
502
  `deliverytime` int(11) DEFAULT NULL COMMENT 'vendor delivery time',
502
  `deliverytime` int(11) DEFAULT NULL COMMENT 'vendor delivery time',
503
  `external_id` varchar(255) DEFAULT NULL COMMENT 'external id of the vendor',
503
  `external_id` varchar(255) DEFAULT NULL COMMENT 'external id of the vendor',
504
  `payment_method` varchar(255) DEFAULT NULL COMMENT 'the payment method for the vendor',
504
  PRIMARY KEY (`id`),
505
  PRIMARY KEY (`id`),
505
  KEY `listprice` (`listprice`),
506
  KEY `listprice` (`listprice`),
506
  KEY `invoiceprice` (`invoiceprice`),
507
  KEY `invoiceprice` (`invoiceprice`),
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorFormAdd.vue (-1 / +9 lines)
Lines 95-100 export default { Link Here
95
                    vendor.address4 && (physical += vendor.address4 + "\n");
95
                    vendor.address4 && (physical += vendor.address4 + "\n");
96
                    this.vendor.physical = physical;
96
                    this.vendor.physical = physical;
97
97
98
                    this.vendor.payment_method = vendor.payment_method
99
                        ? vendor.payment_method.split("|")
100
                        : []
98
                    if (!this.vendor.discount) this.vendor.discount = 0.0;
101
                    if (!this.vendor.discount) this.vendor.discount = 0.0;
99
                    const decimalPlaces =
102
                    const decimalPlaces =
100
                        this.vendor.discount.toString().split(".")[1]?.length ||
103
                        this.vendor.discount.toString().split(".")[1]?.length ||
Lines 155-160 export default { Link Here
155
            setWarning(errors.join("<br>"));
158
            setWarning(errors.join("<br>"));
156
            if (errors.length) return false;
159
            if (errors.length) return false;
157
160
161
            if (vendor.payment_method && vendor.payment_method.length > 0) {
162
                vendor.payment_method = vendor.payment_method.join("|")
163
            } else {
164
                vendor.payment_method = null
165
            }
166
158
            const client = APIClient.acquisition;
167
            const client = APIClient.acquisition;
159
            if (vendorId) {
168
            if (vendorId) {
160
                client.vendors.update(vendor, vendorId).then(
169
                client.vendors.update(vendor, vendorId).then(
161
- 

Return to bug 38207