Exemplo n.º 1
0
             $result = fetch_owner_reserved_item_rs(get_opendb_session_var('user_id'), $listingObject->getCurrentOrderBy(), $listingObject->getCurrentSortOrder(), $listingObject->getStartIndex(), $listingObject->getItemsPerPage());
         }
     } else {
         $result = fetch_owner_reserved_item_rs(get_opendb_session_var('user_id'), $listingObject->getCurrentOrderBy());
     }
 } else {
     if ($HTTP_VARS['op'] == 'my_item_history') {
         $show_listings = FALSE;
         $item_r = fetch_item_instance_r($HTTP_VARS['item_id'], $HTTP_VARS['instance_no']);
         if (is_not_empty_array($item_r)) {
             $footer_links_r[] = array(url => "item_display.php?item_id=" . $item_r['item_id'] . "&instance_no=" . $item_r['instance_no'], text => get_opendb_lang_var('back_to_item'));
             if (is_opendb_session_var('listing_url_vars')) {
                 $footer_links_r[] = array(url => "listings.php?" . get_url_string(get_opendb_session_var('listing_url_vars')), text => get_opendb_lang_var('back_to_listing'));
             }
             // Cannot view item history, unless you are admin, or own the item.
             if (is_user_owner_of_item($item_r['item_id'], $item_r['instance_no'], get_opendb_session_var('user_id')) || is_user_granted_permission(PERM_ADMIN_BORROWER)) {
                 $show_listings = TRUE;
                 $titleMaskCfg = new TitleMask('item_display');
                 $page_title = get_opendb_lang_var('history_for_title', 'display_title', $titleMaskCfg->expand_item_title($item_r));
                 $page_image = get_item_image($item_r['s_item_type'], $item_r['item_id']);
                 if (is_numeric($listingObject->getItemsPerPage())) {
                     $listingObject->setTotalItems(fetch_item_instance_history_cnt($item_r['item_id'], $item_r['instance_no']));
                     if ($listingObject->getTotalItemCount() > 0) {
                         $result = fetch_item_instance_history_rs($item_r['item_id'], $item_r['instance_no'], $listingObject->getCurrentOrderBy(), $listingObject->getCurrentSortOrder(), $listingObject->getStartIndex(), $listingObject->getItemsPerPage());
                     }
                 } else {
                     $result = fetch_item_instance_history_rs($item_r['item_id'], $item_r['instance_no'], $listingObject->getCurrentOrderBy(), $listingObject->getCurrentSortOrder());
                 }
             } else {
                 opendb_not_authorised_page();
             }
Exemplo n.º 2
0
function is_newinstance_status_type_valid($item_id, $owner_id, $new_status_type_r, &$errors)
{
    if ($new_status_type_r['closed_ind'] != 'Y') {
        if ((get_opendb_config_var('item_input', 'item_instance_support') !== FALSE || !is_exists_item_instance($item_id)) && (get_opendb_config_var('item_input', 'new_instance_owner_only') !== TRUE || is_user_owner_of_item($item_id, NULL, $owner_id))) {
            return TRUE;
        } else {
            $errors = array('error' => get_opendb_lang_var('operation_not_avail_new_instance'), 'detail' => '');
            return FALSE;
        }
    } else {
        $errors = array('error' => get_opendb_lang_var('s_status_type_not_supported', 's_status_type_desc', $new_status_type_r['description']), 'detail' => '');
        return FALSE;
    }
}
Exemplo n.º 3
0
function handle_extension($sequence_number, $borrow_extension, $more_information, &$errors)
{
    $borrowed_item_r = fetch_borrowed_item_r($sequence_number);
    if (!is_user_owner_of_item($borrowed_item_r['item_id'], $borrowed_item_r['instance_no']) && !is_user_granted_permission(PERM_ADMIN_BORROWER)) {
        $errors = get_opendb_lang_var('not_owner_of_item');
        return FALSE;
    } else {
        if ($borrowed_item_r['status'] == 'C') {
            $errors = get_opendb_lang_var('already_checked_in');
            return FALSE;
        } else {
            if ($borrowed_item_r['status'] != 'B') {
                $errors = get_opendb_lang_var('borrowed_item_not_found');
                return FALSE;
            } else {
                if (item_borrow_duration_extension($sequence_number, $borrow_extension, $more_information)) {
                    return TRUE;
                } else {
                    return FALSE;
                }
            }
        }
    }
}