Esempio n. 1
0
def document_resolver(loan_pid):
    """Resolve a Document given a Loan PID."""
    Loan = current_circulation.loan_record_cls
    try:
        document_pid = get_field_value(Loan, loan_pid, "document_pid")
    except KeyError:
        return {}

    Document = current_app_ils.document_record_cls
    try:
        document = Document.get_record_by_pid(document_pid)
    except PIDDeletedError:
        obj = {}
    else:
        obj = pick(
            document,
            "authors",
            "circulation",
            "edition",
            "document_type",
            "pid",
            "title",
            # TODO: add the imprint year here
        )

    return obj
 def vendor_resolver(order_pid):
     """Return the Vendor for the given Order."""
     Order = current_ils_acq.order_record_cls
     Vendor = current_ils_acq.vendor_record_cls
     vendor_pid = get_field_value(Order, order_pid, "vendor_pid")
     vendor = Vendor.get_record_by_pid(vendor_pid)
     return pick(vendor, "pid", "name", "address", "email", "phone",
                 "notes")
    def location_resolver(internal_loc_pid):
        """Return the Location record for the given Internal Loc. or raise."""
        location_pid = get_field_value(InternalLocation, internal_loc_pid,
                                       "location_pid")
        location = Location.get_record_by_pid(location_pid)
        del location["$schema"]

        return location
Esempio n. 4
0
def loan_patron_resolver(loan_pid):
    """Resolve a Patron given a Loan PID."""
    Loan = current_circulation.loan_record_cls
    try:
        patron_pid = get_field_value(Loan, loan_pid, "patron_pid")
    except KeyError:
        return {}

    return get_patron(patron_pid)
    def borrowing_request_resolver(request_pid):
        """Return the Patron record for the given Brw Request or raise."""
        request_record_cls = current_ils_ill.borrowing_request_record_cls
        patron_pid = get_field_value(request_record_cls, request_pid,
                                     "patron_pid")

        Patron = current_app_ils.patron_cls
        patron = Patron.get_patron(patron_pid)
        return patron.dumps_loader()
Esempio n. 6
0
    def patron_resolver(document_request_pid):
        """Get the Patron record for the given DocumentRequest or raise."""
        try:
            patron_pid = get_field_value(
                DocumentRequest, document_request_pid, "patron_pid"
            )
        except KeyError:
            return {}

        return get_patron(patron_pid)
    def borrowing_request_resolver(request_pid):
        """Return the Library record for the given Brw Request or raise."""
        request_record_cls = current_ils_ill.borrowing_request_record_cls
        library_pid = get_field_value(request_record_cls, request_pid,
                                      "library_pid")

        library_record_cls = current_ils_ill.library_record_cls
        library = library_record_cls.get_record_by_pid(library_pid)

        return pick(library, "pid", "name")
 def document_resolver(document_request_pid):
     """Get the Document record for the given DocumentRequest or raise."""
     try:
         document_pid = get_field_value(DocumentRequest,
                                        document_request_pid,
                                        "document_pid")
         if not document_pid:
             return {}
         return get_document(document_pid)
     except KeyError:
         return {}
    def borrowing_request_resolver(request_pid):
        """Return the Library record for the given Brw Request or raise."""
        request_record_cls = current_ils_ill.borrowing_request_record_cls
        library_pid = get_field_value(
            request_record_cls, request_pid, "library_pid"
        )

        library_record_cls = current_ils_ill.library_record_cls
        library = library_record_cls.get_record_by_pid(library_pid)
        del library["$schema"]

        return library
Esempio n. 10
0
 def document_resolver(eitem_pid):
     """Return the Document record for the given EItem or raise."""
     document_pid = get_field_value(EItem, eitem_pid, "document_pid")
     return get_document(document_pid)
Esempio n. 11
0
 def borrowing_request_resolver(request_pid):
     """Return the Document record for the given Brw Request or raise."""
     request_record_cls = current_ils_ill.borrowing_request_record_cls
     document_pid = get_field_value(request_record_cls, request_pid,
                                    "document_pid")
     return get_document(document_pid)
 def internal_location_resolver(item_pid):
     """Return the IntLoc record for the given Item or raise."""
     internal_loc_pid = get_field_value(Item, item_pid,
                                        "internal_location_pid")
     return get_internal_location(internal_loc_pid)