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

(-)a/Koha/Acquisition/Bookseller.pm (-3 / +21 lines)
Lines 60-68 Returns the list of contacts for the vendor Link Here
60
=cut
60
=cut
61
61
62
sub contacts {
62
sub contacts {
63
    my ($self) = @_;
63
    my ( $self, $contacts ) = @_;
64
    my $contacts_rs = $self->_result->aqcontacts;
64
65
    return Koha::Acquisition::Bookseller::Contacts->_new_from_dbic($contacts_rs);
65
    if ($contacts) {
66
        my $schema = $self->_result->result_source->schema;
67
        $schema->txn_do(
68
            sub {
69
                $self->contacts->delete;
70
                for my $contact (@$contacts) {
71
                    Koha::Acquisition::Bookseller::Contact->new(
72
                        {
73
                            %$contact,
74
                            booksellerid => $self->id,
75
                        }
76
                    )->store;
77
                }
78
            }
79
        );
80
    }
81
82
    my $rs = $self->_result->aqcontacts;
83
    return Koha::Acquisition::Bookseller::Contacts->_new_from_dbic($rs);
66
}
84
}
67
85
68
=head3 contracts
86
=head3 contracts
(-)a/Koha/REST/V1/Acquisitions/Vendors.pm (-8 / +2 lines)
Lines 98-107 sub add { Link Here
98
    return try {
98
    return try {
99
        $vendor_to_store->store;
99
        $vendor_to_store->store;
100
100
101
        foreach my $contact (@$contacts) {
101
        $vendor_to_store->contacts($contacts)     if scalar($contacts) > 0;
102
            $contact->{booksellerid} = $vendor_to_store->id;
103
            Koha::Acquisition::Bookseller::Contact->new($contact)->store;
104
        }
105
        $vendor_to_store->aliases($aliases)       if scalar($aliases) > 0;
102
        $vendor_to_store->aliases($aliases)       if scalar($aliases) > 0;
106
        $vendor_to_store->interfaces($interfaces) if scalar($interfaces) > 0;
103
        $vendor_to_store->interfaces($interfaces) if scalar($interfaces) > 0;
107
104
Lines 142-151 sub update { Link Here
142
        $vendor->set_from_api($vendor_update);
139
        $vendor->set_from_api($vendor_update);
143
        $vendor->store();
140
        $vendor->store();
144
141
145
        foreach my $contact (@$contacts) {
142
        $vendor->contacts($contacts)     if scalar($contacts) > 0;
146
            $contact->{booksellerid} = $vendor_id;
147
            Koha::Acquisition::Bookseller::Contact->new($contact)->store;
148
        }
149
        $vendor->aliases($aliases)       if scalar($aliases) > 0;
143
        $vendor->aliases($aliases)       if scalar($aliases) > 0;
150
        $vendor->interfaces($interfaces) if scalar($interfaces) > 0;
144
        $vendor->interfaces($interfaces) if scalar($interfaces) > 0;
151
145
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorContacts.vue (-3 / +2 lines)
Lines 149-155 Link Here
149
            <div style="display: flex">
149
            <div style="display: flex">
150
                <div>
150
                <div>
151
                    <fieldset class="rows">
151
                    <fieldset class="rows">
152
                        <legend>Acquisitions options</legend>
152
                        <legend>{{ $__("Acquisitions options") }}</legend>
153
                        <ol class="radio">
153
                        <ol class="radio">
154
                            <li>
154
                            <li>
155
                                <label>
155
                                <label>
Lines 216-222 Link Here
216
                </div>
216
                </div>
217
                <div>
217
                <div>
218
                    <fieldset class="rows">
218
                    <fieldset class="rows">
219
                        <legend>Serials options</legend>
219
                        <legend>{{ $__("Serials options") }}</legend>
220
                        <ol class="radio">
220
                        <ol class="radio">
221
                            <li>
221
                            <li>
222
                                <label>
222
                                <label>
223
- 

Return to bug 38010