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

(-)a/Koha/Acquisition/Bookseller.pm (+21 lines)
Lines 23-28 use Koha::Acquisition::Bookseller::Interfaces; Link Here
23
use Koha::Acquisition::Bookseller::Issues;
23
use Koha::Acquisition::Bookseller::Issues;
24
use Koha::Subscriptions;
24
use Koha::Subscriptions;
25
25
26
use C4::Contract qw( GetContracts );
27
26
use base qw( Koha::Object );
28
use base qw( Koha::Object );
27
29
28
=head1 NAME
30
=head1 NAME
Lines 63-68 sub contacts { Link Here
63
    return Koha::Acquisition::Bookseller::Contacts->_new_from_dbic( $contacts_rs );
65
    return Koha::Acquisition::Bookseller::Contacts->_new_from_dbic( $contacts_rs );
64
}
66
}
65
67
68
=head3 contracts
69
70
    my $vendor   = Koha::Acquisition::Booksellers->find( $id );
71
    my @contracts = $vendor->contracts();
72
73
Returns the list of contracts for the vendor
74
75
=cut
76
77
sub contracts {
78
    my ($self) = @_;
79
    return GetContracts(
80
        {
81
            booksellerid => $self->id,
82
        }
83
    );
84
}
85
86
66
=head3 subscriptions
87
=head3 subscriptions
67
88
68
    my $vendor        = Koha::Acquisition::Booksellers->find( $id );
89
    my $vendor        = Koha::Acquisition::Booksellers->find( $id );
(-)a/api/v1/swagger/definitions/vendor.yaml (+9 lines)
Lines 125-130 properties: Link Here
125
  subscriptions:
125
  subscriptions:
126
    type: array
126
    type: array
127
    description: List of subscriptions
127
    description: List of subscriptions
128
  interfaces:
129
    type: array
130
    description: List of interfaces
131
  contacts:
132
    type: array
133
    description: List of contacts
134
  contracts:
135
    type: array
136
    description: List of contracts
128
additionalProperties: false
137
additionalProperties: false
129
required:
138
required:
130
  - name
139
  - name
(-)a/api/v1/swagger/paths/acquisitions_vendors.yaml (+15 lines)
Lines 137-142 Link Here
137
    summary: Get vendor
137
    summary: Get vendor
138
    parameters:
138
    parameters:
139
      - $ref: "../swagger.yaml#/parameters/vendor_id_pp"
139
      - $ref: "../swagger.yaml#/parameters/vendor_id_pp"
140
      - name: x-koha-embed
141
        in: header
142
        required: false
143
        description: Embed list sent as a request header
144
        type: array
145
        items:
146
          type: string
147
          enum:
148
            - aliases
149
            - baskets
150
            - subscriptions
151
            - interfaces
152
            - contacts
153
            - contracts
154
        collectionFormat: csv
140
    produces:
155
    produces:
141
      - application/json
156
      - application/json
142
    responses:
157
    responses:
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorContacts.vue (+97 lines)
Line 0 Link Here
1
<template>
2
    <fieldset class="rows">
3
        <h2>
4
            {{ $__("Contact") }}
5
        </h2>
6
        <span v-if="vendor.contacts.length === 0">{{
7
            $__("No contacts")
8
        }}</span>
9
        <ol v-for="contact in vendor.contacts" :key="contact.id">
10
            <legend>{{ contact.name }}</legend>
11
            <li>
12
                <label>{{ $__("Position") }}:</label>
13
                <span>{{ contact.position }}</span>
14
            </li>
15
            <li>
16
                <label>{{ $__("Phone") }}:</label>
17
                <span>{{ contact.phone }}</span>
18
            </li>
19
            <li>
20
                <label>{{ $__("Alternative phone") }}:</label>
21
                <span>{{ contact.altphone }}</span>
22
            </li>
23
            <li>
24
                <label>{{ $__("Fax") }}:</label>
25
                <span>{{ contact.fax }}</span>
26
            </li>
27
            <li v-if="contact.email">
28
                <label>{{ $__("Email") }}:</label>
29
                <span>
30
                    <a :href="`mailto:${contact.email}`" target="_blank">{{
31
                        contact.email
32
                    }}</a>
33
                </span>
34
            </li>
35
            <li v-if="contact.notes">
36
                <label>{{ $__("Notes") }}:</label>
37
                <span>{{ contact.notes }}</span>
38
            </li>
39
            <li
40
                v-if="
41
                    contact.acqprimary ||
42
                    contact.orderacquisition ||
43
                    contact.claimacquisition
44
                "
45
            >
46
                <span class="label">{{ $__("Acquisitions options") }}:</span>
47
                <ol>
48
                    <li v-if="contact.acqprimary">
49
                        <span
50
                            ><i class="fa fa-check"></i>
51
                            {{ $__("Primary acquisitions contact") }}</span
52
                        >
53
                    </li>
54
                    <li v-if="contact.orderacquisition">
55
                        <span
56
                            ><i class="fa fa-check"></i>
57
                            {{ $__("Receives orders") }}</span
58
                        >
59
                    </li>
60
                    <li v-if="contact.claimacquisition">
61
                        <span
62
                            ><i class="fa fa-check"></i>
63
                            {{ $__("Receives claims for late orders") }}</span
64
                        >
65
                    </li>
66
                </ol>
67
            </li>
68
            <li v-if="contact.serialsprimary || contact.claimissues">
69
                <span class="label">{{ $__("Serials options") }}:</span>
70
                <ol>
71
                    <li v-if="contact.serialsprimary">
72
                        <span
73
                            ><i class="fa fa-check"></i>
74
                            {{ $__("Primary serials contact") }}</span
75
                        >
76
                    </li>
77
                    <li v-if="contact.claimissues">
78
                        <span
79
                            ><i class="fa fa-check"></i>
80
                            {{ $__("Receives claims for late issues") }}</span
81
                        >
82
                    </li>
83
                </ol>
84
            </li>
85
        </ol>
86
    </fieldset>
87
</template>
88
89
<script>
90
export default {
91
    props: {
92
        vendor: Object,
93
    },
94
}
95
</script>
96
97
<style></style>
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorContracts.vue (+64 lines)
Line 0 Link Here
1
<template>
2
    <h2>{{ $__("Contract(s)") }}</h2>
3
    <div class="dataTables_wrapper no-footer">
4
        <table id="contractst">
5
            <thead>
6
                <tr>
7
                    <th scope="col">{{ $__("Name") }}</th>
8
                    <th scope="col">{{ $__("Description") }}</th>
9
                    <th scope="col">{{ $__("Start date") }}</th>
10
                    <th scope="col">{{ $__("End date") }}</th>
11
                    <!-- PERMISSION CAN_user_acquisition_contracts_manage -->
12
                    <th v-if="false" scope="col" class="NoSort noExport">
13
                        {{ $__("Actions") }}
14
                    </th>
15
                </tr>
16
            </thead>
17
            <tbody>
18
                <tr v-for="(contract, i) in vendor.contracts" :key="i">
19
                    <td>
20
                        <a
21
                            :href="`/cgi-bin/koha/admin/aqcontract.pl?op=add_form&contractnumber=${contract.contractnumber}&booksellerid=${contract.booksellerid}`"
22
                            >{{ contract.contractname }}</a
23
                        >
24
                    </td>
25
                    <td>{{ contract.contractdescription }}</td>
26
                    <td :data-order="contract.contractstartdate">
27
                        {{ contract.contractstartdate }}
28
                    </td>
29
                    <td :data-order="contract.contractenddate">
30
                        {{ contract.contractenddate }}
31
                    </td>
32
                    <!-- PERMISSION CAN_user_acquisition_contracts_manage -->
33
                    <td class="actions" v-if="false">
34
                        <a
35
                            class="btn btn-default btn-xs"
36
                            :href="`/cgi-bin/koha/admin/aqcontract.pl?op=add_form&contractnumber=${contract.contractnumber}&booksellerid=${contract.booksellerid}`"
37
                            ><i
38
                                class="fa-solid fa-pencil"
39
                                aria-hidden="true"
40
                            ></i>
41
                            {{ $__("Edit") }}</a
42
                        >
43
                        <a
44
                            class="btn btn-default btn-xs"
45
                            :href="`/cgi-bin/koha/admin/aqcontract.pl?op=delete_confirm&contractnumber=${contract.contractnumber}&booksellerid=${contract.booksellerid}`"
46
                            ><i class="fa fa-trash-can"></i>
47
                            {{ $__("Delete") }}</a
48
                        >
49
                    </td>
50
                </tr>
51
            </tbody>
52
        </table>
53
    </div>
54
</template>
55
56
<script>
57
export default {
58
    props: {
59
        vendor: Object,
60
    },
61
}
62
</script>
63
64
<style></style>
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorDetails.vue (+78 lines)
Line 0 Link Here
1
<template>
2
    <fieldset class="rows">
3
        <h2>
4
            {{ $__("Vendor details") }}
5
        </h2>
6
        <ol>
7
            <li>
8
                <label>{{ $__("Type") }}:</label>
9
                <span>
10
                    {{ vendor.type }}
11
                </span>
12
            </li>
13
            <li>
14
                <label>{{ $__("Company name") }}:</label>
15
                <span>
16
                    {{ vendor.name }}
17
                </span>
18
            </li>
19
            <li>
20
                <label>{{ $__("Postal address") }}:</label>
21
                <span>
22
                    {{ vendor.postal }}
23
                </span>
24
            </li>
25
            <li>
26
                <label>{{ $__("Physical address") }}:</label>
27
                <span>
28
                    {{ vendor.address1 }}
29
                    {{ vendor.address2 }}
30
                    {{ vendor.address3 }}
31
                    {{ vendor.address4 }}
32
                </span>
33
            </li>
34
            <li>
35
                <label>{{ $__("Phone") }}:</label>
36
                <span>
37
                    {{ vendor.phone }}
38
                </span>
39
            </li>
40
            <li>
41
                <label>{{ $__("Fax") }}:</label>
42
                <span>
43
                    {{ vendor.fax }}
44
                </span>
45
            </li>
46
            <li v-if="vendor.url">
47
                <label>{{ $__("Website") }}:</label>
48
                <span>
49
                    {{ vendor.url }}
50
                </span>
51
            </li>
52
            <li v-if="vendor.accountnumber">
53
                <label>{{ $__("Account number") }}:</label>
54
                <span>
55
                    {{ vendor.accountnumber }}
56
                </span>
57
            </li>
58
            <li v-if="vendor.aliases.count">
59
                <label>{{ $__("Aliases") }}:</label>
60
                <ul>
61
                    <li v-for="alias in vendor.aliases" :key="alias">
62
                        {{ alias }}
63
                    </li>
64
                </ul>
65
            </li>
66
        </ol>
67
    </fieldset>
68
</template>
69
70
<script>
71
export default {
72
    props: {
73
        vendor: Object,
74
    },
75
}
76
</script>
77
78
<style></style>
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorInterfaces.vue (+54 lines)
Line 0 Link Here
1
<template>
2
    <fieldset class="rows">
3
        <h2>
4
            {{ $__("Interfaces") }}
5
        </h2>
6
        <ol v-for="vi in vendor.interfaces" :key="vi.id">
7
            <legend>{{ vi.name }}</legend>
8
            <li>
9
                <label>{{ $__("Type") }}:</label>
10
                <span> NEED AUTHORISED VALUES </span>
11
            </li>
12
            <li v-if="vi.uri">
13
                <label>{{ $__("URI") }}:</label>
14
                <span>
15
                    <a :href="vi.uri" target="_blank">{{ vi.uri }}</a>
16
                </span>
17
            </li>
18
            <li v-if="vi.login">
19
                <label>{{ $__("Login") }}:</label>
20
                <span>
21
                    {{ vi.login }}
22
                </span>
23
            </li>
24
            <li v-if="vi.password">
25
                <label>{{ $__("Password") }}:</label>
26
                <span>
27
                    {{ vi.password }}
28
                </span>
29
            </li>
30
            <li v-if="vi.account_email">
31
                <label>{{ $__("Account email") }}:</label>
32
                <span>
33
                    {{ vi.account_email }}
34
                </span>
35
            </li>
36
            <li v-if="vi.notes">
37
                <label>{{ $__("Notes") }}:</label>
38
                <span>
39
                    {{ vi.notes }}
40
                </span>
41
            </li>
42
        </ol>
43
    </fieldset>
44
</template>
45
46
<script>
47
export default {
48
    props: {
49
        vendor: Object,
50
    },
51
}
52
</script>
53
54
<style></style>
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorOrderingInformation.vue (+75 lines)
Line 0 Link Here
1
<template>
2
    <fieldset class="rows">
3
        <h2>
4
            {{ $__("Ordering information") }}
5
        </h2>
6
        <ol>
7
            <li>
8
                <label>{{ $__("Vendor is") }}:</label>
9
                <span>
10
                    {{ vendor.active ? $__("Active") : $__("Inactive") }}
11
                </span>
12
            </li>
13
            <li>
14
                <label>{{ $__("List prices are") }}:</label>
15
                <span>
16
                    {{ vendor.listprice }}
17
                </span>
18
            </li>
19
            <li>
20
                <label>{{ $__("Invoice prices are") }}:</label>
21
                <span>
22
                    {{ vendor.invoiceprice }}
23
                </span>
24
            </li>
25
            <li v-if="vendor.tax_rate">
26
                <label>{{ $__("Tax number registered") }}:</label>
27
                <span>
28
                    {{ vendor.gstreg ? $__("Yes") : $__("No") }}
29
                </span>
30
            </li>
31
            <li v-if="vendor.tax_rate">
32
                <label>{{ $__("List item price includes tax") }}:</label>
33
                <span>
34
                    {{ vendor.listincgst ? $__("Yes") : $__("No") }}
35
                </span>
36
            </li>
37
            <li v-if="vendor.tax_rate">
38
                <label>{{ $__("Invoice item price includes tax") }}:</label>
39
                <span>
40
                    {{ vendor.invoiceincgst ? $__("Yes") : $__("No") }}
41
                </span>
42
            </li>
43
            <li>
44
                <label>{{ $__("Discount") }}:</label>
45
                <span>
46
                    {{ vendor.discount || 0 }}
47
                </span>
48
            </li>
49
            <li>
50
                <label>{{ $__("Tax rate") }}:</label>
51
                <span>
52
                    {{ (vendor.tax_rate || 0) * 100 }}
53
                </span>
54
            </li>
55
            <li v-if="vendor.deliverytime">
56
                <label>{{ $__("Delivery time") }}:</label>
57
                <span> {{ vendor.deliverytime }} days </span>
58
            </li>
59
            <li v-if="vendor.notes">
60
                <label>{{ $__("Notes") }}:</label>
61
                <span> {{ vendor.notes }} days </span>
62
            </li>
63
        </ol>
64
    </fieldset>
65
</template>
66
67
<script>
68
export default {
69
    props: {
70
        vendor: Object,
71
    },
72
}
73
</script>
74
75
<style></style>
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorShow.vue (+123 lines)
Line 0 Link Here
1
<template>
2
    <div v-if="!initialized">{{ $__("Loading") }}</div>
3
    <div v-else id="vendors_show">
4
        <Toolbar>
5
            <ToolbarButton
6
                :to="{ name: 'VendorList' }"
7
                icon="plus"
8
                :title="$__('New vendor')"
9
            />
10
            <ToolbarButton
11
                :to="{ name: 'VendorList' }"
12
                icon="pencil"
13
                :title="$__('Edit vendor')"
14
            />
15
            <ExternalLinkButton
16
                :to="{
17
                    path: '/cgi-bin/koha/acqui/parcels.pl',
18
                    query: { booksellerid: vendor.id },
19
                }"
20
                icon="plus"
21
                :title="$__('Receive shipments')"
22
            />
23
        </Toolbar>
24
        <h1>
25
            {{ vendor.name }}
26
        </h1>
27
        <div class="row">
28
            <div class="col-sm-6">
29
                <VendorDetails :vendor="vendor" />
30
                <VendorOrderingInformation :vendor="vendor" />
31
                <VendorInterfaces
32
                    :vendor="vendor"
33
                    v-if="vendor.interfaces.length > 0"
34
                />
35
            </div>
36
            <div class="col-sm-6">
37
                <VendorContacts :vendor="vendor" />
38
                <VendorSubscriptions :vendor="vendor" />
39
            </div>
40
        </div>
41
        <div
42
            class="page-section rows"
43
            v-if="vendor.contracts && vendor.contracts.length > 0"
44
        >
45
            <VendorContracts :vendor="vendor" />
46
        </div>
47
    </div>
48
</template>
49
50
<script>
51
import Toolbar from "../Toolbar.vue"
52
import ToolbarButton from "../ToolbarButton.vue"
53
import { inject } from "vue"
54
import { APIClient } from "../../fetch/api-client.js"
55
import ExternalLinkButton from "../ExternalLinkButton.vue"
56
import VendorDetails from "./VendorDetails.vue"
57
import VendorOrderingInformation from "./VendorOrderingInformation.vue"
58
import VendorInterfaces from "./VendorInterfaces.vue"
59
import VendorContacts from "./VendorContacts.vue"
60
import VendorSubscriptions from "./VendorSubscriptions.vue"
61
import VendorContracts from "./VendorContracts.vue"
62
63
export default {
64
    setup() {
65
        const format_date = $date
66
        const patron_to_html = $patron_to_html
67
68
        const { setConfirmationDialog, setMessage } = inject("mainStore")
69
70
        // const AVStore = inject("AVStore")
71
        // const { get_lib_from_av } = AVStore
72
73
        return {
74
            format_date,
75
            patron_to_html,
76
            // get_lib_from_av,
77
            setConfirmationDialog,
78
            setMessage,
79
        }
80
    },
81
    data() {
82
        return {
83
            vendor: null,
84
            initialized: false,
85
        }
86
    },
87
    beforeRouteEnter(to, from, next) {
88
        next(vm => {
89
            vm.getVendor(to.params.vendor_id)
90
        })
91
    },
92
    methods: {
93
        async getVendor(vendor_id) {
94
            const client = APIClient.acquisition
95
            client.vendors.get(vendor_id).then(
96
                vendor => {
97
                    this.vendor = vendor
98
                    this.initialized = true
99
                },
100
                error => {}
101
            )
102
        },
103
    },
104
    components: {
105
        Toolbar,
106
        ToolbarButton,
107
        ExternalLinkButton,
108
        VendorDetails,
109
        VendorOrderingInformation,
110
        VendorInterfaces,
111
        VendorContacts,
112
        VendorSubscriptions,
113
        VendorContracts,
114
    },
115
    name: "VendorShow",
116
}
117
</script>
118
119
<style>
120
.vendor_info {
121
    display: grid;
122
}
123
</style>
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorSubscriptions.vue (+27 lines)
Line 0 Link Here
1
<template>
2
    <fieldset class="rows">
3
        <h2>
4
            {{ $__("Subscription details") }}
5
        </h2>
6
        <!-- PERMISSION -->
7
        <p>
8
            <strong>{{ $__("Number of subscriptions") }}: </strong>
9
            <a
10
                v-if="false"
11
                :href="`/cgi-bin/koha/serials/serials-search.pl?bookseller_filter=${vendor.name}&searched=1`"
12
                >{{ vendor.subscriptions.length }}</a
13
            >
14
            <span v-if="true">{{ vendor.subscriptions.length }}</span>
15
        </p>
16
    </fieldset>
17
</template>
18
19
<script>
20
export default {
21
    props: {
22
        vendor: Object,
23
    },
24
}
25
</script>
26
27
<style></style>
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/acquisition-api-client.js (-5 / +2 lines)
Lines 13-19 export class AcquisitionAPIClient extends HttpClient { Link Here
13
                this.get({
13
                this.get({
14
                    endpoint: "vendors/" + id,
14
                    endpoint: "vendors/" + id,
15
                    headers: {
15
                    headers: {
16
                        "x-koha-embed": "aliases",
16
                        "x-koha-embed":
17
                            "baskets,aliases,subscriptions,interfaces,contacts,contracts",
17
                    },
18
                    },
18
                }),
19
                }),
19
            getAll: (query, params) =>
20
            getAll: (query, params) =>
Lines 21-29 export class AcquisitionAPIClient extends HttpClient { Link Here
21
                    endpoint: "vendors",
22
                    endpoint: "vendors",
22
                    query,
23
                    query,
23
                    params,
24
                    params,
24
                    headers: {
25
                        "x-koha-embed": "aliases,baskets",
26
                    },
27
                }),
25
                }),
28
            delete: id =>
26
            delete: id =>
29
                this.delete({
27
                this.delete({
30
- 

Return to bug 38010