Bugzilla – Attachment 96964 Details for
Bug 18731
Add routes for acquisition orders
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18731: Add API mappings to K::A::{Basket,Invoice}
Bug-18731-Add-API-mappings-to-KABasketInvoice.patch (text/plain), 4.15 KB, created by
Kyle M Hall (khall)
on 2020-01-07 20:30:16 UTC
(
hide
)
Description:
Bug 18731: Add API mappings to K::A::{Basket,Invoice}
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2020-01-07 20:30:16 UTC
Size:
4.15 KB
patch
obsolete
>From 5af1a380937ea72a8d5089f45a51f534519d0e8f Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 30 Dec 2019 15:36:57 -0300 >Subject: [PATCH] Bug 18731: Add API mappings to K::A::{Basket,Invoice} > >This patch adds to_api_mapping definitions to the following classes: > >- Koha::Acquisition::Basket >- Koha::Acquisition::Invoice > >They are implemented following the proposed RFCs: >https://wiki.koha-community.org/wiki/Acquisitions_baskets_endpoint_RFC >https://wiki.koha-community.org/wiki/Acquisitions_invoices_endpoint_RFC > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Acquisition/Basket.pm | 47 ++++++++++++++++++++++++++++++++++ > Koha/Acquisition/Invoice.pm | 43 +++++++++++++++++++++++++++++++ > Koha/Schema/Result/Aqbasket.pm | 4 +++ > 3 files changed, 94 insertions(+) > >diff --git a/Koha/Acquisition/Basket.pm b/Koha/Acquisition/Basket.pm >index 5bda3ab303..cdb885b04f 100644 >--- a/Koha/Acquisition/Basket.pm >+++ b/Koha/Acquisition/Basket.pm >@@ -71,6 +71,53 @@ sub effective_create_items { > return $self->create_items || C4::Context->preference('AcqCreateItem'); > } > >+=head3 to_api >+ >+ my $json = $basket->to_api; >+ >+Overloaded method that returns a JSON representation of the Koha::Acquisition::Basket object, >+suitable for API output. >+ >+=cut >+ >+sub to_api { >+ my ( $self ) = @_; >+ >+ my $json = $self->SUPER::to_api; >+ >+ $json->{closed} = ( $self->closedate ) >+ ? Mojo::JSON->true >+ : Mojo::JSON->false; >+ >+ return $json; >+} >+ >+=head3 to_api_mapping >+ >+This method returns the mapping for representing a Koha::Acquisition::Basket object >+on the API. >+ >+=cut >+ >+sub to_api_mapping { >+ return { >+ basketno => 'basket_id', >+ basketname => 'name', >+ booksellernote => 'vendor_note', >+ contractnumber => 'contract_id', >+ creationdate => 'creation_date', >+ closedate => 'close_date', >+ booksellerid => 'vendor_id', >+ authorisedby => 'authorised_by', >+ booksellerinvoicenumber => undef, >+ basketgroupid => 'basket_group_id', >+ deliveryplace => 'delivery_place', >+ billingplace => 'billing_place', >+ branch => 'library_id', >+ is_standing => 'standing' >+ }; >+} >+ > =head2 Internal methods > > =head3 _type >diff --git a/Koha/Acquisition/Invoice.pm b/Koha/Acquisition/Invoice.pm >index 6117322226..2d35d92d33 100644 >--- a/Koha/Acquisition/Invoice.pm >+++ b/Koha/Acquisition/Invoice.pm >@@ -27,6 +27,49 @@ Koha::Acquisition::Invoice object class > > =head1 API > >+ >+=head3 to_api >+ >+ my $json = $invoice->to_api; >+ >+Overloaded method that returns a JSON representation of the Koha::Acquisition::Invoice object, >+suitable for API output. >+ >+=cut >+ >+sub to_api { >+ my ( $self ) = @_; >+ >+ my $json = $self->SUPER::to_api; >+ >+ $json->{closed} = ( $self->closedate ) >+ ? Mojo::JSON->true >+ : Mojo::JSON->false; >+ >+ return $json; >+} >+ >+=head3 to_api_mapping >+ >+This method returns the mapping for representing a Koha::Acquisition::Invoice object >+on the API. >+ >+=cut >+ >+sub to_api_mapping { >+ return { >+ invoiceid => 'invoice_id', >+ invoicenumber => 'invoice_number', >+ booksellerid => 'vendor_id', >+ shipmentdate => 'shipping_date', >+ billingdate => 'invoice_date', >+ closedate => 'close_date', >+ shipmentcost => 'shipping_cost', >+ shipmentcost_budgetid => 'shipping_cost_budget_id', >+ message_id => undef >+ }; >+} >+ > =head2 Internal methods > > =head3 _type >diff --git a/Koha/Schema/Result/Aqbasket.pm b/Koha/Schema/Result/Aqbasket.pm >index 220d91eeef..efbd6a1d36 100644 >--- a/Koha/Schema/Result/Aqbasket.pm >+++ b/Koha/Schema/Result/Aqbasket.pm >@@ -335,4 +335,8 @@ sub koha_objects_class { > 'Koha::Acquisition::Baskets'; > } > >+__PACKAGE__->add_columns( >+ '+is_standing' => { is_boolean => 1 } >+); >+ > 1; >-- >2.21.0 (Apple Git-122.2)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18731
:
69184
|
69185
|
69309
|
69310
|
69544
|
73959
|
73960
|
78435
|
78436
|
84133
|
84134
|
95054
|
95055
|
95056
|
96853
|
96854
|
96855
|
96856
|
96857
|
96858
|
96916
|
96917
|
96918
|
96938
|
96961
|
96962
|
96963
|
96964
|
96965
|
96966
|
97107
|
97108
|
97109
|
97110
|
97111
|
97112
|
97113
|
97331