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

(-)a/Koha/Acquisition/Bookseller.pm (-3 / +22 lines)
Lines 60-70 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
86
68
=head3 contracts
87
=head3 contracts
69
88
70
    my $vendor   = Koha::Acquisition::Booksellers->find( $id );
89
    my $vendor   = Koha::Acquisition::Booksellers->find( $id );
(-)a/Koha/REST/V1/Acquisitions/Vendors.pm (-8 / +2 lines)
Lines 100-109 sub add { Link Here
100
    return try {
100
    return try {
101
        $vendor_to_store->store;
101
        $vendor_to_store->store;
102
102
103
        foreach my $contact (@$contacts) {
103
        $vendor_to_store->contacts($contacts)     if scalar($contacts) > 0;
104
            $contact->{booksellerid} = $vendor_to_store->id;
105
            Koha::Acquisition::Bookseller::Contact->new($contact)->store;
106
        }
107
        $vendor_to_store->aliases($aliases)       if scalar($aliases) > 0;
104
        $vendor_to_store->aliases($aliases)       if scalar($aliases) > 0;
108
        $vendor_to_store->interfaces($interfaces) if scalar($interfaces) > 0;
105
        $vendor_to_store->interfaces($interfaces) if scalar($interfaces) > 0;
109
106
Lines 145-154 sub update { Link Here
145
        $vendor->set_from_api($vendor_update);
142
        $vendor->set_from_api($vendor_update);
146
        $vendor->store();
143
        $vendor->store();
147
144
148
        foreach my $contact (@$contacts) {
145
        $vendor->contacts($contacts)     if scalar($contacts) > 0;
149
            $contact->{booksellerid} = $vendor_id;
150
            Koha::Acquisition::Bookseller::Contact->new($contact)->store;
151
        }
152
        $vendor->aliases($aliases)       if scalar($aliases) > 0;
146
        $vendor->aliases($aliases)       if scalar($aliases) > 0;
153
        $vendor->interfaces($interfaces) if scalar($interfaces) > 0;
147
        $vendor->interfaces($interfaces) if scalar($interfaces) > 0;
154
148
(-)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