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

(-)a/Koha/REST/V1/ERM/Agreements.pm (-12 / +14 lines)
Lines 92-103 sub add { Link Here
92
92
93
                my $body = $c->req->json;
93
                my $body = $c->req->json;
94
94
95
                my $periods    = delete $body->{periods} // [];
95
                my $periods                 = delete $body->{periods}                 // [];
96
                my $user_roles = delete $body->{user_roles} // [];
96
                my $user_roles              = delete $body->{user_roles}              // [];
97
                my $agreement_licenses = delete $body->{agreement_licenses} // [];
97
                my $agreement_licenses      = delete $body->{agreement_licenses}      // [];
98
                my $agreement_relationships = delete $body->{agreement_relationships} // [];
98
                my $agreement_relationships = delete $body->{agreement_relationships} // [];
99
                my $documents = delete $body->{documents} // [];
99
                my $documents               = delete $body->{documents}               // [];
100
                my $extended_attributes = delete $body->{extended_attributes} // [];
100
                my $extended_attributes     = delete $body->{extended_attributes}     // [];
101
101
102
                my $agreement = Koha::ERM::Agreement->new_from_api($body)->store;
102
                my $agreement = Koha::ERM::Agreement->new_from_api($body)->store;
103
                $agreement->periods($periods);
103
                $agreement->periods($periods);
Lines 106-112 sub add { Link Here
106
                $agreement->agreement_relationships($agreement_relationships);
106
                $agreement->agreement_relationships($agreement_relationships);
107
                $agreement->documents($documents);
107
                $agreement->documents($documents);
108
108
109
                my @extended_attributes = map { {'id' => $_->{field_id}, 'value' => $_->{value}} } @{$extended_attributes};
109
                my @extended_attributes =
110
                    map { { 'id' => $_->{field_id}, 'value' => $_->{value} } } @{$extended_attributes};
110
                $agreement->extended_attributes( \@extended_attributes );
111
                $agreement->extended_attributes( \@extended_attributes );
111
112
112
                $c->res->headers->location($c->req->url->to_string . '/' . $agreement->agreement_id);
113
                $c->res->headers->location($c->req->url->to_string . '/' . $agreement->agreement_id);
Lines 180-191 sub update { Link Here
180
181
181
                my $body = $c->req->json;
182
                my $body = $c->req->json;
182
183
183
                my $periods    = delete $body->{periods} // [];
184
                my $periods                 = delete $body->{periods}                 // [];
184
                my $user_roles = delete $body->{user_roles} // [];
185
                my $user_roles              = delete $body->{user_roles}              // [];
185
                my $agreement_licenses = delete $body->{agreement_licenses} // [];
186
                my $agreement_licenses      = delete $body->{agreement_licenses}      // [];
186
                my $agreement_relationships = delete $body->{agreement_relationships} // [];
187
                my $agreement_relationships = delete $body->{agreement_relationships} // [];
187
                my $documents = delete $body->{documents} // [];
188
                my $documents               = delete $body->{documents}               // [];
188
                my $extended_attributes = delete $body->{extended_attributes} // [];
189
                my $extended_attributes     = delete $body->{extended_attributes}     // [];
189
190
190
                $agreement->set_from_api($body)->store;
191
                $agreement->set_from_api($body)->store;
191
                $agreement->periods($periods);
192
                $agreement->periods($periods);
Lines 194-200 sub update { Link Here
194
                $agreement->agreement_relationships($agreement_relationships);
195
                $agreement->agreement_relationships($agreement_relationships);
195
                $agreement->documents($documents);
196
                $agreement->documents($documents);
196
197
197
                my @extended_attributes = map { {'id' => $_->{field_id}, 'value' => $_->{value}} } @{$extended_attributes};
198
                my @extended_attributes =
199
                    map { { 'id' => $_->{field_id}, 'value' => $_->{value} } } @{$extended_attributes};
198
                $agreement->extended_attributes( \@extended_attributes );
200
                $agreement->extended_attributes( \@extended_attributes );
199
201
200
                $c->res->headers->location($c->req->url->to_string . '/' . $agreement->agreement_id);
202
                $c->res->headers->location($c->req->url->to_string . '/' . $agreement->agreement_id);
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue (-2 / +4 lines)
Lines 115-121 export default { Link Here
115
            searchable_av_options: [],
115
            searchable_av_options: [],
116
            tableOptions: {
116
            tableOptions: {
117
                columns: this.getTableColumns(),
117
                columns: this.getTableColumns(),
118
                options: { embed: "user_roles,vendor,extended_attributes,+strings" },
118
                options: {
119
                    embed: "user_roles,vendor,extended_attributes,+strings",
120
                },
119
                url: () => this.table_url(),
121
                url: () => this.table_url(),
120
                table_settings: this.agreement_table_settings,
122
                table_settings: this.agreement_table_settings,
121
                add_filters: true,
123
                add_filters: true,
Lines 186-192 export default { Link Here
186
                error => {}
188
                error => {}
187
            )
189
            )
188
        },
190
        },
189
	    async getSearchableAdditionalFields() {
191
        async getSearchableAdditionalFields() {
190
            const client = APIClient.additional_fields
192
            const client = APIClient.additional_fields
191
            await client.additional_fields.getAll("agreement").then(
193
            await client.additional_fields.getAll("agreement").then(
192
                searchable_additional_fields => {
194
                searchable_additional_fields => {
(-)a/t/cypress/integration/AdditionalFields_spec.ts (-4 / +4 lines)
Lines 113-119 function get_no_additional_fields_agreement() { Link Here
113
        ],
113
        ],
114
        extended_attributes: [],
114
        extended_attributes: [],
115
        _strings: {
115
        _strings: {
116
            "additional_field_values": []
116
            additional_field_values: [],
117
        },
117
        },
118
    };
118
    };
119
}
119
}
Lines 1055-1061 describe("Additional Fields operations", () => { Link Here
1055
        ).as("avcategories");
1055
        ).as("avcategories");
1056
1056
1057
        cy.visit("/cgi-bin/koha/erm/agreements");
1057
        cy.visit("/cgi-bin/koha/erm/agreements");
1058
        cy.get("#agreements_list table tbody tr:first").contains("Edit").click();
1058
        cy.get("#agreements_list table tbody tr:first")
1059
            .contains("Edit")
1060
            .click();
1059
        cy.wait("@get-agreement");
1061
        cy.wait("@get-agreement");
1060
        cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet!
1062
        cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet!
1061
1063
Lines 1122-1126 describe("Additional Fields operations", () => { Link Here
1122
            "#agreements_add form #additional_fields label[for='additional_field_3']"
1124
            "#agreements_add form #additional_fields label[for='additional_field_3']"
1123
        ).should("have.length", 2);
1125
        ).should("have.length", 2);
1124
    });
1126
    });
1125
1126
});
1127
});
1127
- 

Return to bug 37576