Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- indexing
- description: "Objects that represent an EV_TITLED_WINDOW.%
- %The original version of this class was generated by EiffelBuild."
- date: "$Date: 2003/09/11 21:03:35 $"
- revision: "$Revision: 1.3 $"
- class
- MAIN_WINDOW
- inherit
- MAIN_WINDOW_IMP
- FINE_LAYOUTS
- undefine default_create,copy
- end
- ITEM_LAYOUTS
- undefine default_create,copy
- end
- LOAN_LAYOUTS
- undefine default_create,copy
- end
- MEMBER_LAYOUTS
- undefine default_create,copy
- end
- RESERVATION_LAYOUTS
- undefine default_create,copy
- end
- feature {NONE} -- Initialization
- user_initialization is
- -- called by `initialize'.
- -- Any custom user initialization that
- -- could not be performed in `initialize',
- -- (due to regeneration of implementation class)
- -- can be added here.
- do
- create db.make
- end
- feature {NONE} -- Implementation
- close_window is
- -- Called by `close_request_actions' of `Current'.
- do
- exit_system
- end
- feature -- Member Functions
- logged_in_user:MEMBER
- set_user(s:STRING) is
- --
- do
- -- logged_in_user ?= db.members.item(s)
- -- if logged_in_user.member_type /= "Administrator" then
- if not(db.members.item(s).member_type.is_equal("Administrator")) then
- members_frame.destroy
- addcopybutton.hide
- add_item_button.hide
- delete_item_button.hide
- amend_item_button.hide
- view_item_copy_button.hide
- search_loan_button.hide
- add_loan_button.hide
- returns_loan_button.hide
- reservations_frame.destroy
- fines_frame.destroy
- add_loan_button.hide
- returns_loan_button.hide
- search_loan_button.hide
- lending_rights_button.hide
- overdue_button.hide
- list_current_loans_button.select_actions.extend(agent g_list_current_loans(s))
- list_finished_loans_button.select_actions.extend(agent g_list_finished_loans(s))
- end
- end
- add_member is
- -- Called by `select_actions' of `add_member_button'.
- do
- delete_member_button.disable_sensitive
- amend_member_button.disable_sensitive
- show_member_frame.wipe_out
- show_member_frame.extend (add_member_layout)
- administrator_layout
- member_type.change_actions.extend (agent change_member_type)
- submit_button.select_actions.extend (agent add_member_to_members)
- clear_member_button.select_actions.extend (agent add_member)
- end
- change_member_type is
- --
- do
- if member_type.text.is_equal("Administrator") then
- main_area.wipe_out
- administrator_layout
- elseif member_type.text.is_equal("Staff") then
- main_area.wipe_out
- staff_layout
- elseif member_type.text.is_equal("Undergraduate") then
- main_area.wipe_out
- undergraduate_layout
- elseif member_type.text.is_equal("Postgraduate") then
- main_area.wipe_out
- postgraduate_layout
- elseif member_type.text.is_equal("Visitor") then
- main_area.wipe_out
- visitor_layout
- end
- end
- add_member_to_members is
- local
- a:ADMINISTRATOR
- sf:STAFF
- u:UNDERGRADUATE
- p:POSTGRADUATE
- v:VISITOR
- nid:STRING
- d:DATE
- year1,year2:STRING
- added:EV_INFORMATION_DIALOG
- do
- create d.make_now
- year1 := d.year.out.substring(3,3)
- year2 := d.year.out.substring(4,4)
- if not(validate("^Administrator|Staff|Undergraduate|Postgraduate|Visitor$",member_type.text,false)) then
- message_dialog("Invalid Member Type. Please select one from the list.")
- elseif not(validate("^[\w]{5}[\w]*$",password_field.text,false)) then
- message_dialog("Password must be at least 5 characters")
- elseif not(validate("^Active|Suspended|Inactive$",status.text,false)) then
- message_dialog("Invalid Status. Please select one from the list")
- elseif not(validate("^[A-Za-z]{2,4}$",name_title_field.text,false)) then
- message_dialog("Invalid Title. Please do not include a .")
- elseif not(validate("^[A-Z]{1}[A-Z]{0,1}$",initials_field.text,false)) then
- message_dialog("Please enter up to 2 initials without a space.")
- elseif not(validate("^[A-Za-z-']{2,30}$",last_name_field.text,false)) then
- message_dialog("Invalid Surname")
- elseif not(validate("^[\w\-\'0-9 ]{5,30}$",address1_field.text,false)) then
- message_dialog("Invalid Address1")
- elseif not(validate("^[\w-'0-9 ]{5,30}$",address2_field.text,false)) then
- message_dialog("Invalid Address2")
- elseif not(validate("^[A-Za-z-' ]{5,30}$",town_field.text,false)) then
- message_dialog("Invalid Town")
- elseif not(validate("^[A-Za-z-' ]{5,30}$",county_field.text,false)) then
- message_dialog("Invalid County")
- elseif not(validate("^[A-Z0-9]{3,4} [A-Z0-9]{3,4}$",postcode_field.text,false)) then
- message_dialog("Invalid Postcode. Letters must be uppercase and in the format: XXX[X] XXX[X]")
- elseif not(validate("^([0-2][0-9]|3[0-1])/(1[0-2]|0[0-9])/(19[0-9]{2})|2000$",dob_field.text,false))then
- message_dialog("Invalid Date of birth. Must be in the format DD/MM/YYYY.")
- else
- nid:=db.next_user_id(member_type.text)
- if member_type.text.is_equal("Administrator") then
- create a
- a.make(nid, password_field.text, member_type.text, status.text, name_title_field.text, initials_field.text, last_name_field.text, address1_field.text, address2_field.text,
- town_field.text, county_field.text, postcode_field.text, dob_field.text, senior_button.is_selected)
- db.members.put(a,nid)
- create added.make_with_text ("New Member Added")
- added.set_title("Saved")
- added.show_modal_to_window (Current)
- elseif member_type.text.is_equal("Staff") then
- if not(validate("^[A-Za-z-' ]{5,30}$",department_field.text,false)) then
- message_dialog("Invalid Department")
- else
- create sf
- sf.make(nid, password_field.text, member_type.text, status.text,name_title_field.text, initials_field.text, last_name_field.text, address1_field.text, address2_field.text,
- town_field.text, county_field.text, postcode_field.text, dob_field.text, department_field.text)
- db.members.extend(sf,nid)
- create added.make_with_text ("New Member Added")
- added.set_title("Saved")
- added.show_modal_to_window (Current)
- end
- elseif member_type.text.is_equal("Undergraduate") then
- if not(validate("^[A-Z]{3}[A-Z]{4}$",course_field.text,false)) then
- message_dialog("Invalid Course. Must be in format AAAAAAA e.g. BSCCOMP")
- else
- create u
- u.make(nid, password_field.text, member_type.text, status.text, name_title_field.text, initials_field.text, last_name_field.text, address1_field.text, address2_field.text,
- town_field.text, county_field.text, postcode_field.text, dob_field.text, course_field.text, parttime_button.is_selected)
- db.members.extend(u,nid)
- create added.make_with_text ("New Member Added")
- added.set_title("Saved")
- added.show_modal_to_window (Current)
- end
- elseif member_type.text.is_equal("Postgraduate") then
- if not(validate("^[A-Z]{3}[A-Z]{4}$",course_field.text,false)) then
- message_dialog("Invalid Course. Must be in format AAAAAAA e.g. BSCCOMP")
- else
- create p
- p.make(nid, password_field.text, member_type.text, status.text, name_title_field.text, initials_field.text, last_name_field.text, address1_field.text, address2_field.text,
- town_field.text, county_field.text, postcode_field.text, dob_field.text, course_field.text, parttime_button.is_selected)
- db.members.extend(p,nid)
- create added.make_with_text ("New Member Added")
- added.set_title("Saved")
- added.show_modal_to_window (Current)
- end
- elseif member_type.text.is_equal("Visitor") then
- create v
- v.make(nid, password_field.text, member_type.text, status.text, name_title_field.text, initials_field.text, last_name_field.text, address1_field.text, address2_field.text,
- town_field.text, county_field.text, postcode_field.text, dob_field.text)
- db.members.extend(v,nid)
- create added.make_with_text ("New Member Added")
- added.set_title("Saved")
- added.show_modal_to_window (Current)
- end
- end
- end -- add_member
- delete_member is
- -- Called by `select_actions' of `delete_member_button'.
- -- require
- -- s: members_list.selected_item /= void
- do
- show_member_frame.wipe_out
- delete_member_button.disable_sensitive
- amend_member_button.disable_sensitive
- if db.members.item(members_list.selected_item.i_th(1)).num_of_items_out /= 0 then
- message_dialog("You cannot delete a member who has items on loan")
- else
- db.members.remove(members_list.selected_item.i_th(1))
- list_member
- end
- end -- delete_member
- amend_member is
- -- Called by `select_actions' of `amend_member_button'.
- local
- a:ADMINISTRATOR
- sf:STAFF
- u:UNDERGRADUATE
- p:POSTGRADUATE
- v:VISITOR
- memberid:STRING
- do
- delete_member_button.disable_sensitive
- amend_member_button.disable_sensitive
- if members_list.selected_item /= void then
- create a
- create sf
- create u
- create p
- create v
- memberid := members_list.selected_item.i_th(1)
- a ?= db.members.item(memberid)
- sf ?= db.members.item(memberid)
- u ?= db.members.item(memberid)
- p ?= db.members.item(memberid)
- v ?= db.members.item(memberid)
- show_member_frame.wipe_out
- show_member_frame.extend(add_member_layout)
- member_type.disable_sensitive
- if a /= void then
- administrator_layout
- password_field.set_text(a.password)
- member_type.set_text(a.member_type)
- status.set_text(a.status)
- name_title_field.set_text(a.name_title)
- initials_field.set_text(a.initials)
- last_name_field.set_text(a.last_name)
- address1_field.set_text(a.address1)
- address2_field.set_text(a.address2)
- town_field.set_text(a.town)
- county_field.set_text(a.county)
- postcode_field.set_text(a.postcode)
- dob_field.set_text(a.date_of_birth.out)
- if a.senior = true
- then
- senior_button.enable_select
- end
- submit_button.select_actions.extend (agent update_member("Administrator",memberid))
- elseif sf /= void then
- staff_layout
- password_field.set_text(sf.password)
- member_type.set_text(sf.member_type)
- status.set_text(sf.status)
- name_title_field.set_text(sf.name_title)
- initials_field.set_text(sf.initials)
- last_name_field.set_text(sf.last_name)
- address1_field.set_text(sf.address1)
- address2_field.set_text(sf.address2)
- town_field.set_text(sf.town)
- county_field.set_text(sf.county)
- postcode_field.set_text(sf.postcode)
- dob_field.set_text(sf.date_of_birth.out)
- department_field.set_text(sf.department)
- submit_button.select_actions.extend (agent update_member("Staff",memberid))
- elseif u /= void then
- undergraduate_layout
- password_field.set_text(u.password)
- member_type.set_text(u.member_type)
- status.set_text(u.status)
- name_title_field.set_text(u.name_title)
- initials_field.set_text(u.initials)
- last_name_field.set_text(u.last_name)
- address1_field.set_text(u.address1)
- address2_field.set_text(u.address2)
- town_field.set_text(u.town)
- county_field.set_text(u.county)
- postcode_field.set_text(u.postcode)
- dob_field.set_text(u.date_of_birth.out)
- course_field.set_text(u.course)
- if u.parttime = true
- then
- parttime_button.enable_select
- end
- submit_button.select_actions.extend (agent update_member("Undergraduate",memberid))
- elseif p /= void then
- postgraduate_layout
- password_field.set_text(p.password)
- member_type.set_text(p.member_type)
- status.set_text(p.status)
- name_title_field.set_text(p.name_title)
- initials_field.set_text(p.initials)
- last_name_field.set_text(p.last_name)
- address1_field.set_text(p.address1)
- address2_field.set_text(p.address2)
- town_field.set_text(p.town)
- county_field.set_text(p.county)
- postcode_field.set_text(p.postcode)
- dob_field.set_text(p.date_of_birth.out)
- course_field.set_text(p.course)
- if p.parttime = true
- then
- parttime_button.enable_select
- end
- submit_button.select_actions.extend (agent update_member("Postgraduate",memberid))
- elseif v /= void then
- visitor_layout
- password_field.set_text(v.password)
- member_type.set_text(v.member_type)
- status.set_text(v.status)
- name_title_field.set_text(v.name_title)
- initials_field.set_text(v.initials)
- last_name_field.set_text(v.last_name)
- address1_field.set_text(v.address1)
- address2_field.set_text(v.address2)
- town_field.set_text(v.town)
- county_field.set_text(v.county)
- postcode_field.set_text(v.postcode)
- dob_field.set_text(v.date_of_birth.out)
- end
- end
- end
- update_member(type:STRING;memberid:STRING) is
- local
- a:ADMINISTRATOR
- sf:STAFF
- u:UNDERGRADUATE
- p:POSTGRADUATE
- v:VISITOR
- updated:EV_INFORMATION_DIALOG
- do
- if not(validate("^Administrator|Staff|Undergraduate|Postgraduate|Vistor$",member_type.text,false)) then
- message_dialog("Invalid Member Type. Please select one from the list.")
- elseif not(validate("^[\w]{5}[\w]*$",password_field.text,false)) then
- message_dialog("Password must be at least 5 characters")
- elseif not(validate("^Active|Suspended|Inactive$",status.text,false)) then
- message_dialog("Invalid Status. Please select one from the list")
- elseif not(validate("^[A-Za-z]{2,4}$",name_title_field.text,false)) then
- message_dialog("Invalid Title. Please do not include a .")
- elseif not(validate("^[A-Z]{1}[A-Z]{0,1}$",initials_field.text,false)) then
- message_dialog("Please enter up to 2 initials without a space.")
- elseif not(validate("^[A-Za-z-']{2,30}$",last_name_field.text,false)) then
- message_dialog("Invalid Surname")
- elseif not(validate("^[\w\-\'0-9 ]{5,30}$",address1_field.text,false)) then
- message_dialog("Invalid Address1")
- elseif not(validate("^[\w-'0-9 ]{5,30}$",address2_field.text,false)) then
- message_dialog("Invalid Address2")
- elseif not(validate("^[A-Za-z-' ]{5,30}$",town_field.text,false)) then
- message_dialog("Invalid Town")
- elseif not(validate("^[A-Za-z-' ]{5,30}$",county_field.text,false)) then
- message_dialog("Invalid County")
- elseif not(validate("^[A-Z0-9]{3,4} [A-Z0-9]{3,4}$",postcode_field.text,false)) then
- message_dialog("Invalid Postcode. Letters must be uppercase and in the format: XXX[X] XXX[X]")
- elseif not(validate("^[0-3][0-9]/[0-1][0-9]/[1-2][90][0-9][0-9]$",dob_field.text,false)) then
- message_dialog("Invalid Date of birth. Must be in the format DD/MM/YYYY")
- else
- if type.is_equal("Administrator") then
- create a
- a.make(memberid, password_field.text, member_type.text, status.text, name_title_field.text, initials_field.text, last_name_field.text, address1_field.text, address2_field.text,
- town_field.text, county_field.text, postcode_field.text, dob_field.text, senior_button.is_selected)
- db.members.replace(a,memberid)
- create updated.make_with_text ("Member Details Updated")
- updated.set_title("Saved")
- updated.show_modal_to_window (Current)
- elseif type.is_equal("Staff") then
- if not(validate("^[A-Za-z-' ]{5,30}$",department_field.text,false)) then
- message_dialog("Invalid Department")
- else
- create sf
- sf.make(memberid, password_field.text, member_type.text, status.text, name_title_field.text, initials_field.text, last_name_field.text, address1_field.text, address2_field.text,
- town_field.text, county_field.text, postcode_field.text, dob_field.text, department_field.text)
- db.members.replace(sf,memberid)
- create updated.make_with_text ("Member Details Updated")
- updated.set_title("Saved")
- updated.show_modal_to_window (Current)
- end
- elseif type.is_equal("Undergraduate") then
- if not(validate("^[A-Za-z-' ]{5,30}$",course_field.text,false)) then
- message_dialog("Invalid Course")
- else
- create u
- u.make(memberid, password_field.text, member_type.text, status.text, name_title_field.text, initials_field.text, last_name_field.text, address1_field.text, address2_field.text,
- town_field.text, county_field.text, postcode_field.text, dob_field.text, course_field.text, parttime_button.is_selected)
- db.members.replace(u,memberid)
- create updated.make_with_text ("Member Details Updated")
- updated.set_title("Saved")
- updated.show_modal_to_window (Current)
- end
- elseif type.is_equal("Postgraduate") then
- if not(validate("^[A-Za-z-' ]{5,30}$",course_field.text,false)) then
- message_dialog("Invalid Course")
- else
- create p
- p.make(memberid, password_field.text, member_type.text, status.text, name_title_field.text, initials_field.text, last_name_field.text, address1_field.text, address2_field.text,
- town_field.text, county_field.text, postcode_field.text, dob_field.text, course_field.text, parttime_button.is_selected)
- db.members.replace(p,memberid)
- create updated.make_with_text ("Member Details Updated")
- updated.set_title("Saved")
- updated.show_modal_to_window (Current)
- end
- elseif type.is_equal("Visitor") then
- create v
- v.make(memberid, password_field.text, member_type.text, status.text, name_title_field.text, initials_field.text, last_name_field.text, address1_field.text, address2_field.text,
- town_field.text, county_field.text, postcode_field.text, dob_field.text)
- db.members.replace(v,memberid)
- create updated.make_with_text ("Member Details Updated")
- updated.set_title("Saved")
- updated.show_modal_to_window (Current)
- end
- end
- end -- update_member
- search_member is
- -- Called by `select_actions' of `search_member_button'.
- local
- types: ARRAY [STRING]
- do
- show_member_frame.wipe_out
- show_member_frame.extend(search_layout)
- delete_member_button.disable_sensitive
- amend_member_button.disable_sensitive
- create types.make(1,3)
- types.put("Member ID",1)
- types.put("Surname",2)
- types.put("Date Of Birth",3)
- search_combo.set_strings(types)
- search_button.select_actions.extend (agent search_for_member)
- clear_button.select_actions.extend (agent search_member)
- end
- search_for_member is
- local
- search_field,search_text:STRING
- regexp:RX_PCRE_REGULAR_EXPRESSION
- m:MEMBER
- do
- search_text := search_info_field.text
- search_field := search_combo.text
- create regexp.make
- regexp.set_caseless (true)
- regexp.compile(search_text)
- check
- is_compiled: regexp.is_compiled
- end
- show_member_frame.wipe_out
- show_member_frame.extend(list_members_layout)
- if search_field.is_equal("Member ID") then
- from
- db.members.start
- until
- db.members.off
- loop
- regexp.match(db.members.item_for_iteration.memberid.out)
- if regexp.has_matched then
- members_list.extend(db.members.item_for_iteration.row_representation)
- end
- db.stock.forth
- end
- elseif search_field.is_equal("Surname") then
- from
- db.members.start
- until
- db.members.off
- loop
- regexp.match(db.members.item_for_iteration.last_name)
- if regexp.has_matched then
- members_list.extend(db.members.item_for_iteration.row_representation)
- end
- db.members.forth
- end
- elseif search_field.is_equal("Date Of Birth") then
- from
- db.members.start
- until
- db.members.off
- loop
- m ?= db.members.item_for_iteration
- if not(m = void) then
- regexp.match(m.date_of_birth)
- if regexp.has_matched then
- members_list.extend(db.members.item_for_iteration.row_representation)
- end
- end
- db.members.forth
- end
- end
- set_member_column_names
- end -- search_members
- list_member is
- -- Called by `select_actions' of `list_member_button'.
- do
- show_member_frame.wipe_out
- show_member_frame.extend(list_members_layout)
- delete_member_button.disable_sensitive
- amend_member_button.disable_sensitive
- from
- db.members.start
- until
- db.members.off
- loop
- members_list.extend(db.members.item_for_iteration.row_representation)
- db.members.forth
- end
- set_member_column_names
- end -- list_member
- member_on_list_selected(an_item: EV_MULTI_COLUMN_LIST_ROW) is
- --
- do
- delete_member_button.enable_sensitive
- amend_member_button.enable_sensitive
- end
- member_on_list_deselected(an_item: EV_MULTI_COLUMN_LIST_ROW) is
- --
- do
- delete_member_button.disable_sensitive
- amend_member_button.disable_sensitive
- end
- exit_member is
- -- Called by `select_actions' of `exit_member_button'.
- local
- pixmap:EV_PIXMAP
- do
- create pixmap
- show_member_frame.wipe_out
- pixmap.set_with_named_file (".\library.png")
- show_member_frame.extend (pixmap)
- end -- exit_member
- feature --Item Functions
- currently_editing:STRING
- add_item is
- -- Called by `select_actions' of `add_item_button'.
- do
- delete_item_button.disable_sensitive
- amend_item_button.disable_sensitive
- addcopybutton.disable_sensitive
- view_item_copy_button.disable_sensitive
- show_item_frame.wipe_out
- show_item_frame.extend(add_item_layout)
- book_layout
- item_type.change_actions.extend (agent change_stock_type)
- submit_item_button.select_actions.extend (agent add_item_to_stock)
- -- clear_item_button.select_actions.extend (agent clear_item_button)
- end
- change_stock_type is
- --
- do
- --rather than layouts just rename the text labels.
- --They all use the same number of fields.
- if item_type.text.is_equal("Book") then
- main_area.wipe_out
- book_layout
- elseif item_type.text.is_equal("CD") then
- main_area.wipe_out
- cd_layout
- elseif item_type.text.is_equal("Journal") then
- main_area.wipe_out
- journal_layout
- elseif item_type.text.is_equal("Video/DVD") then
- main_area.wipe_out
- video_layout
- end
- end
- add_item_to_stock is
- --
- local
- b:BOOK
- j:JOURNAL
- d:DVD
- cd:CD
- isbnstr,issnstr,gid:STRING
- date:DATE
- do
- create date.make_now
- if item_type.text.is_equal("Book") then
- isbnstr := isbn_field.text
- isbnstr := reg_replace(" |-","",isbnstr,true)--remove spaces and dashes from the isbn.
- isbnstr := reg_replace("x","X",isbnstr,true)--convert x's to uppercase.
- if not(validate_modulo_11(isbn_field.text,10)) then
- message_dialog("Invalid ISBN")
- elseif db.stock.item(isbnstr) /= void then
- message_dialog("This book is already in the Library. Check the ISBN?")
- elseif not(validate("^[A-Za-z0-9\ \-\.]{3,50}$",item_title_field.text,false)) then
- message_dialog("Invalid Title")
- elseif not(validate("^[\w \-]{5,200}$",author_field.text,false)) then
- message_dialog("Invalid Author(s) Name")
- elseif not(validate("^[\w ]{3,25}$",publisher_field.text,false)) then
- message_dialog("Invalid Publisher")
- elseif not(validate("^[0-9]{1,3}$",edition_field.text,false)) then
- message_dialog("Edition must be up to 3 digit number.")
- elseif not(validate("^[\w -]{3,24}$",genre_field.text,false)) then
- message_dialog("Invalid Genre")
- elseif not(validate("^[0-9]{4}$",year_field.text,false)) then
- message_dialog("Year must be in format YYYY")
- elseif year_field.text.to_integer > date.year then
- message_dialog("Invalid Year.")
- elseif not(validate("^[0-9]{3}[\.0-9]*$",classification_field.text,false)) then
- message_dialog("Invalid Classification. Classification must be in format 000[.000]")
- else
- create b
- b.make(isbnstr,item_title_field.text,author_field.text,publisher_field.text,genre_field.text,year_field.text.to_integer,edition_field.text.to_integer,classification_field.text.to_real,db.next_accession_number)
- db.stock.put(b,isbnstr)
- message_dialog("Book added.")
- end --add book
- elseif item_type.text.is_equal("CD") then
- if not(validate("^[A-Za-z0-9\ \-\.]{3,25}$",item_title_field.text,false)) then
- message_dialog("Invalid Title")
- elseif not(validate("^[\w \-]{5,200}$",artist_field.text,false)) then
- message_dialog("Invalid Artist(s) Name")
- elseif not(validate("^[\w ]{3,25}$",publisher_field.text,false)) then
- message_dialog("Invalid Publisher")
- elseif not(validate("^[\w -]{3,24}$",genre_field.text,false)) then
- message_dialog("Invalid Genre")
- else
- create cd
- gid := db.next_generated_id
- cd.make(gid, item_title_field.text,artist_field.text,publisher_field.text,genre_field.text, db.next_accession_number)
- db.stock.put(cd,gid)
- message_dialog("CD added.")
- end
- elseif item_type.text.is_equal("Journal") then
- issnstr := issn_field.text
- issnstr := reg_replace(" |-","",issnstr,true)--remove spaces and dashes from the isbn.
- issnstr := reg_replace("x","X",issnstr,true)--convert x's to uppercase.
- if not(validate_modulo_11(issn_field.text,8)) then
- message_dialog("Invalid ISSN")
- elseif db.stock.item(issnstr) /= void then
- message_dialog("This Journal is already in the Library. Check the ISSN?")
- elseif not(validate("^[A-Za-z0-9\ \-\.]{3,25}$",item_title_field.text,false)) then
- message_dialog("Invalid Title")
- elseif not(validate("^[\w \-]{5,200}$",author_field.text,false)) then
- message_dialog("Invalid Author(s) Name")
- elseif not(validate("^[\w ]{3,25}$",publisher_field.text,false)) then
- message_dialog("Invalid Publisher")
- elseif not(validate("^[0-9]{4}$",year_field.text,false)) then
- message_dialog("Year must be in format YYYY")
- elseif year_field.text.to_integer > date.year then
- message_dialog("Invalid Year.")
- elseif not(validate("^[\w -]{3,24}$",subject_field.text,false)) then
- message_dialog("Invalid Subject")
- else
- create j
- j.make(issnstr,item_title_field.text,author_field.text,publisher_field.text,year_field.text,subject_field.text,db.next_accession_number)
- db.stock.put(j,issnstr)
- message_dialog("Journal added.")
- end
- elseif item_type.text.is_equal("Video/DVD") then
- if not(validate("^[A-Za-z0-9\ \-\.]{3,25}$",item_title_field.text,false)) then
- message_dialog("Invalid Title")
- elseif not(validate("^[\w ]{3,25}$",publisher_field.text,false)) then
- message_dialog("Invalid Publisher")
- elseif not(validate("^[\w -]{3,24}$",genre_field.text,false)) then
- message_dialog("Invalid Genre")
- elseif not(validate("^[0-9]{4}$",year_field.text,false)) then
- message_dialog("Year must be in format YYYY")
- elseif year_field.text.to_integer > date.year then
- message_dialog("Invalid Year.")
- elseif not(validate("^[\w ]{3,25}$",director_field.text,false)) then
- message_dialog("Invalid Director Name")
- elseif not(validate("^[0-9]+\:[0-5][0-9]$",length_field.text,false)) then
- message_dialog("Invalid Length. Format: [h]h:mm")
- else
- create d
- gid := db.next_generated_id
- d.make(gid,item_title_field.text,publisher_field.text,genre_field.text,year_field.text,director_field.text,length_field.text,db.next_accession_number)
- db.stock.put(d,gid)
- message_dialog("Video/DVD Added")
- end
- end
- end
- delete_item is
- -- Called by `select_actions' of `delete_item_button'.
- local
- unable:BOOLEAN
- do
- delete_item_button.disable_sensitive
- amend_item_button.disable_sensitive
- addcopybutton.disable_sensitive
- view_item_copy_button.disable_sensitive
- if currently_editing.is_equal("Title") then
- unable := false
- from
- db.stock.item(items_list.selected_item.i_th(1)).copies.start
- until
- db.stock.item(items_list.selected_item.i_th(1)).copies.off
- loop
- if db.stock.item(items_list.selected_item.i_th(1)).copies.item_for_iteration.is_on_loan then
- unable:= true
- end
- db.stock.item(items_list.selected_item.i_th(1)).copies.forth
- end
- if items_list.selected_item /= void then
- if unable = true then
- message_dialog("You cannot remove an item with copies that are currently on loan")
- else
- db.stock.remove(items_list.selected_item.i_th(1))
- list_item
- end
- end
- elseif currently_editing.is_equal("Copy") then
- if copies_list.selected_item /= void then
- if db.stock.item(ref_no).copies.item(copies_list.selected_item.i_th(1)).is_on_loan then
- message_dialog("You cannot delete a copy that is currently on loan")
- else
- db.stock.item(ref_no).copies.remove(copies_list.selected_item.i_th(1))
- view_copies
- end
- end
- end
- end
- amend_item is
- -- Called by `select_actions' of `amend_item_button'.
- local
- b:BOOK
- j:JOURNAL
- d:DVD
- c:CD
- do
- delete_item_button.disable_sensitive
- amend_item_button.disable_sensitive
- addcopybutton.disable_sensitive
- view_item_copy_button.disable_sensitive
- if currently_editing.is_equal("Title") then
- if items_list.selected_item /= void then
- create b
- create j
- create d
- create c
- b ?= db.stock.item(items_list.selected_item.i_th(1))
- j ?= db.stock.item(items_list.selected_item.i_th(1))
- d ?= db.stock.item(items_list.selected_item.i_th(1))
- c ?= db.stock.item(items_list.selected_item.i_th(1))
- show_item_frame.wipe_out
- show_item_frame.extend(add_item_layout)
- if b /= void then
- book_layout
- isbn_field.set_text(b.reference_number)
- isbn_field.disable_sensitive
- author_field.set_text(b.author)
- genre_field.set_text(b.genre)
- item_title_field.set_text(b.title)
- publisher_field.set_text(b.publisher)
- year_field.set_text(b.year.out)
- item_type.set_text("Book")
- item_type.disable_sensitive
- classification_field.set_text(b.classification.out)
- edition_field.set_text(b.edition.out)
- submit_item_button.select_actions.extend (agent amend_item_in_stock(isbn_field.text))
- elseif j /= void then
- item_type.set_text("Journal")
- item_type.disable_sensitive
- journal_layout
- issn_field.set_text(j.reference_number)
- issn_field.disable_sensitive
- author_field.set_text(j.author)
- item_title_field.set_text(j.title)
- subject_field.set_text(j.subject)
- year_field.set_text(j.year)
- publisher_field.set_text(j.publisher)
- submit_item_button.select_actions.extend (agent amend_item_in_stock(issn_field.text))
- elseif c /= void then
- item_type.set_text("CD")
- item_type.disable_sensitive
- cd_layout
- artist_field.set_text(c.artist)
- genre_field.set_text(c.genre)
- item_title_field.set_text(c.title)
- publisher_field.set_text(c.publisher)
- end
- end
- elseif currently_editing.is_equal("Copy") then
- show_item_frame.wipe_out
- show_item_frame.extend(amend_copy_layout)
- accession_number_field.set_text(db.stock.item(ref_no).copies.item(copies_list.selected_item.i_th(1)).accession_number)
- accession_number_field.disable_sensitive
- if db.stock.item(ref_no).copies.item(copies_list.selected_item.i_th(1)).is_on_loan then
- on_loan_button.enable_select
- end
- on_loan_button.disable_sensitive
- if db.stock.item(ref_no).copies.item(copies_list.selected_item.i_th(1)).is_reference_only then
- reference_button.enable_select
- end
- if db.stock.item(ref_no).copies.item(copies_list.selected_item.i_th(1)).is_for_part_time_students_only then
- parttime_button.enable_select
- end
- submit_button.select_actions.extend (agent update_copy)
- end
- end
- update_copy is
- do
- --update copy
- db.stock.item(ref_no).copies.item(copies_list.selected_item.i_th(1)).set_for_part_time_students_only(parttime_button.is_selected)
- db.stock.item(ref_no).copies.item(copies_list.selected_item.i_th(1)).set_reference_only(reference_button.is_selected)
- message_dialog("Copy Updated")
- view_copies
- end
- amend_item_in_stock(i:STRING) is
- local
- b:BOOK
- j:JOURNAL
- c:CD
- d:DVD
- issnstr,isbnstr:STRING
- date:DATE
- do
- b ?= db.stock.item(i)
- j ?= db.stock.item(i)
- c ?= db.stock.item(i)
- d ?= db.stock.item(i)
- create date.make_now
- if b /= void then
- isbnstr := isbn_field.text
- isbnstr := reg_replace(" |-","",isbnstr,true)--remove spaces and dashes from the isbn.
- isbnstr := reg_replace("x","X",isbnstr,true)--convert x's to uppercase.
- if not(validate_modulo_11(isbn_field.text,10)) then
- message_dialog("Invalid ISBN")
- elseif not(validate("^[A-Za-z0-9\ \-\.]{3,50}$",item_title_field.text,false)) then
- message_dialog("Invalid Title")
- elseif not(validate("^[\w \-]{5,200}$",author_field.text,false)) then
- message_dialog("Invalid Author(s) Name")
- elseif not(validate("^[\w ]{3,25}$",publisher_field.text,false)) then
- message_dialog("Invalid Publisher")
- elseif not(validate("^[0-9]{1,3}$",edition_field.text,false)) then
- message_dialog("Edition must be up to 3 digit number.")
- elseif not(validate("^[\w -]{3,24}$",genre_field.text,false)) then
- message_dialog("Invalid Genre")
- elseif not(validate("^[0-9]{4}$",year_field.text,false)) then
- message_dialog("Year must be in format YYYY")
- elseif year_field.text.to_integer > date.year then
- message_dialog("Invalid Year.")
- elseif not(validate("^[0-9]{3}[\.0-9]*$",classification_field.text,false)) then
- message_dialog("Invalid Classification. Classification must be in format 000[.000]")
- else
- b.amend(isbn_field.text,item_title_field.text,author_field.text,publisher_field.text,genre_field.text,year_field.text.to_integer,edition_field.text.to_integer,classification_field.text.to_real)
- db.stock.replace(b,isbn_field.text)
- message_dialog("Book Updated")
- end
- elseif j /= void then
- issnstr := issn_field.text
- issnstr := reg_replace(" |-","",issnstr,true)--remove spaces and dashes from the isbn.
- issnstr := reg_replace("x","X",issnstr,true)--convert x's to uppercase.
- if not(validate_modulo_11(issn_field.text,8)) then
- message_dialog("Invalid ISSN")
- elseif db.stock.item(issnstr) /= void then
- message_dialog("This Journal is already in the Library. Check the ISSN?")
- elseif not(validate("^[A-Za-z0-9\ \-\.]{3,25}$",item_title_field.text,false)) then
- message_dialog("Invalid Title")
- elseif not(validate("^[\w \-]{5,200}$",author_field.text,false)) then
- message_dialog("Invalid Author(s) Name")
- elseif not(validate("^[\w ]{3,25}$",publisher_field.text,false)) then
- message_dialog("Invalid Publisher")
- elseif not(validate("^[0-9]{4}$",year_field.text,false)) then
- message_dialog("Year must be in format YYYY")
- elseif year_field.text.to_integer > date.year then
- message_dialog("Invalid Year.")
- elseif not(validate("^[\w -]{3,24}$",subject_field.text,false)) then
- message_dialog("Invalid Subject")
- else
- j.amend(issn_field.text,item_title_field.text,author_field.text,publisher_field.text,year_field.text,subject_field.text)
- db.stock.replace(b,issn_field.text)
- message_dialog("Journal Updated")
- end
- elseif c /= void then
- if not(validate("^[A-Za-z0-9\ \-\.]{3,25}$",item_title_field.text,false)) then
- message_dialog("Invalid Title")
- elseif not(validate("^[\w \-]{5,200}$",artist_field.text,false)) then
- message_dialog("Invalid Artist(s) Name")
- elseif not(validate("^[\w ]{3,25}$",publisher_field.text,false)) then
- message_dialog("Invalid Publisher")
- elseif not(validate("^[\w -]{3,24}$",genre_field.text,false)) then
- message_dialog("Invalid Genre")
- else
- c.amend(c.reference_number,item_title_field.text,artist_field.text,publisher_field.text,genre_field.text)
- db.stock.replace(c,c.reference_number)
- message_dialog("CD Updated")
- end
- elseif d /= void then
- if not(validate("^[A-Za-z0-9\ \-\.]{3,25}$",item_title_field.text,false)) then
- message_dialog("Invalid Title")
- elseif not(validate("^[\w ]{3,25}$",publisher_field.text,false)) then
- message_dialog("Invalid Publisher")
- elseif not(validate("^[\w -]{3,24}$",genre_field.text,false)) then
- message_dialog("Invalid Genre")
- elseif not(validate("^[0-9]{4}$",year_field.text,false)) then
- message_dialog("Year must be in format YYYY")
- elseif year_field.text.to_integer > date.year then
- message_dialog("Invalid Year.")
- elseif not(validate("^[\w ]{3,25}$",director_field.text,false)) then
- message_dialog("Invalid Director Name")
- elseif not(validate("^[0-9]+\:[0-5][0-9]$",length_field.text,false)) then
- message_dialog("Invalid Length. Format: [h]h:mm")
- else
- d.amend(d.reference_number,item_title_field.text,publisher_field.text,genre_field.text,year_field.text,director_field.text,length_field.text)
- db.stock.replace(d,d.reference_number)
- message_dialog("DVD/Video Updated")
- end
- end
- end
- search_item is
- -- Called by `select_actions' of `search_item_button'.
- local
- types: ARRAY [STRING]
- do
- delete_item_button.disable_sensitive
- amend_item_button.disable_sensitive
- addcopybutton.disable_sensitive
- view_item_copy_button.disable_sensitive
- show_item_frame.wipe_out
- show_item_frame.extend(search_layout)
- create types.make(1,3)
- types.put("Reference Number (isbn, issn, etc)",1)
- types.put("Title",2)
- types.put("Author",3)
- search_combo.set_strings(types)
- search_button.select_actions.extend (agent search_for_item)
- clear_button.select_actions.extend (agent search_item)
- end
- search_for_item is
- local
- search_field,search_text:STRING
- regexp:RX_PCRE_REGULAR_EXPRESSION
- b:BOOK
- --
- do
- search_text := search_info_field.text
- search_text := reg_replace(" |-","",search_text,true)
- search_text := reg_replace("x","X",search_text,true)
- search_field := search_combo.text
- create regexp.make
- regexp.set_caseless (true)
- regexp.compile(search_text)
- check
- is_compiled: regexp.is_compiled
- end
- show_item_frame.wipe_out
- show_item_frame.extend(list_items_layout)
- if search_field.is_equal("Reference Number (isbn, issn, etc)") then
- from
- db.stock.start
- until
- db.stock.off
- loop
- regexp.match(db.stock.item_for_iteration.reference_number)
- if regexp.has_matched then
- items_list.extend(db.stock.item_for_iteration.row_representation)
- end
- db.stock.forth
- end
- elseif search_field.is_equal("Title") then
- from
- db.stock.start
- until
- db.stock.off
- loop
- regexp.match(db.stock.item_for_iteration.title)
- if regexp.has_matched then
- items_list.extend(db.stock.item_for_iteration.row_representation)
- end
- db.stock.forth
- end
- elseif search_field.is_equal("Author") then
- from
- db.stock.start
- until
- db.stock.off
- loop
- b ?= db.stock.item_for_iteration
- if not(b = void) then
- regexp.match(b.author)
- if regexp.has_matched then
- items_list.extend(db.stock.item_for_iteration.row_representation)
- end
- end
- db.stock.forth
- end
- end
- set_item_column_names
- end
- list_item is
- -- Called by `select_actions' of `list_item_button'.
- do
- delete_item_button.disable_sensitive
- amend_item_button.disable_sensitive
- addcopybutton.disable_sensitive
- view_item_copy_button.disable_sensitive
- show_item_frame.wipe_out
- show_item_frame.extend(list_items_layout)
- from
- db.stock.start
- until
- db.stock.off
- loop
- items_list.extend(db.stock.item_for_iteration.row_representation)
- db.stock.forth
- end
- set_item_column_names
- -- message_dialog(db.stock.count.out)
- end
- item_on_list_selected(an_item: EV_MULTI_COLUMN_LIST_ROW) is
- --
- do
- currently_editing := "Title"
- delete_item_button.enable_sensitive
- amend_item_button.enable_sensitive
- addcopybutton.enable_sensitive
- view_item_copy_button.enable_sensitive
- end
- item_on_list_deselected(an_item: EV_MULTI_COLUMN_LIST_ROW) is
- --
- do
- delete_item_button.disable_sensitive
- amend_item_button.disable_sensitive
- addcopybutton.disable_sensitive
- view_item_copy_button.disable_sensitive
- end
- add_copy is
- --
- local
- scopy:STOCK_COPY
- an:STRING
- do
- delete_item_button.disable_sensitive
- amend_item_button.disable_sensitive
- addcopybutton.disable_sensitive
- view_item_copy_button.disable_sensitive
- if items_list /= void and then items_list.selected_item /= void then
- an := db.next_accession_number
- create scopy.make(an)
- db.stock.item(items_list.selected_item.i_th(1)).copies.put(scopy,an)
- list_item
- end
- end
- exit_item is
- -- Called by `select_actions' of `exit_item_button'.
- local
- pixmap:EV_PIXMAP
- do
- create pixmap
- show_item_frame.wipe_out
- pixmap.set_with_named_file (".\library.png")
- show_item_frame.extend (pixmap)
- end
- ref_no:STRING
- view_copies is
- --
- do
- delete_item_button.disable_sensitive
- amend_item_button.disable_sensitive
- addcopybutton.disable_sensitive
- view_item_copy_button.disable_sensitive
- addcopybutton.disable_sensitive
- show_item_frame.wipe_out
- show_item_frame.extend(list_copies_layout)
- ref_no := items_list.selected_item.i_th(1)
- from
- db.stock.item(items_list.selected_item.i_th(1)).copies.start
- until
- db.stock.item(items_list.selected_item.i_th(1)).copies.off
- loop
- copies_list.extend(db.stock.item(items_list.selected_item.i_th(1)).copies.item_for_iteration.row_representation)
- db.stock.item(items_list.selected_item.i_th(1)).copies.forth
- end
- set_copies_column_names
- end
- item_on_copies_list_selected(an_item: EV_MULTI_COLUMN_LIST_ROW) is
- --
- do
- currently_editing := "Copy"
- delete_item_button.enable_sensitive
- amend_item_button.enable_sensitive
- end
- item_on_copies_list_deselected(an_item: EV_MULTI_COLUMN_LIST_ROW) is
- --
- do
- delete_item_button.disable_sensitive
- amend_item_button.disable_sensitive
- end
- feature --Loan Functions
- found:INTEGER
- add_loan is
- -- Called by `select_actions' of `add_loan_button'.
- do
- show_loan_frame.wipe_out
- show_loan_frame.extend(add_loan_layout)
- returns_loan_button.disable_sensitive
- renew_loan_button.disable_sensitive
- found := 0
- submit_button.disable_sensitive
- enter_itemid_field.enable_sensitive
- find_item_button.enable_sensitive
- enter_memberid_field.enable_sensitive
- find_member_button.enable_sensitive
- find_member_button.select_actions.extend (agent find_member)
- find_item_button.select_actions.extend (agent find_item)
- submit_button.select_actions.extend (agent submit_loan)
- clear_loan_button.select_actions.extend (agent add_loan)
- end -- add_loan
- find_item is
- local
- itemstr,accstr:STRING
- do
- itemstr := enter_itemid_field.text
- accstr := enter_accessionid_field.text
- if itemstr.is_equal("") or accstr.is_equal("") then
- message_dialog("Please enter an item ID and accession number id")
- else
- itemstr := reg_replace(" |-","",itemstr,true)
- itemstr := reg_replace("x","X",itemstr,true)
- accstr := reg_replace(" |-","",accstr,true)
- accstr := reg_replace("x","X",accstr,true)
- if not(validate_modulo_11(itemstr,itemstr.count)) then
- message_dialog("Invalid Item ID")
- elseif not(validate_modulo_11(accstr,10)) then
- message_dialog("Invalid accession number")
- else
- if db.stock.item(itemstr) = void then
- message_dialog("Item not found")
- else
- if db.stock.item(itemstr).copies.item(accstr) = void then
- message_dialog("Accession number does not belong to that book.")
- else
- item_title_field.set_text(db.stock.item(itemstr).title)
- if db.stock.item(itemstr).copies.item(accstr).is_on_loan = false then
- available.enable_select
- end
- enter_itemid_field.disable_sensitive
- enter_accessionid_field.disable_sensitive
- find_item_button.disable_sensitive
- found := found + 1
- if found = 2 then
- submit_button.enable_sensitive
- end
- end
- end
- end
- end
- end -- find_item
- find_member is
- local
- memberstr:STRING
- do
- memberstr := enter_memberid_field.text
- if memberstr.is_equal("") then
- message_dialog("Please enter a member id")
- else
- memberstr := reg_replace(" |-","",memberstr,true)
- memberstr := reg_replace("x","X",memberstr,true)
- if not(validate_modulo_11(memberstr,8)) then
- message_dialog("Invalid Member ID")
- else
- if db.members.item(memberstr) = void then
- message_dialog("Member not found")
- else
- last_name_field.set_text(db.members.item(memberstr).last_name)
- dob_field.set_text(db.members.item(memberstr).date_of_birth)
- member_type_field.set_text(db.members.item(memberstr).member_type)
- enter_memberid_field.disable_sensitive
- find_member_button.disable_sensitive
- found := found + 1
- if found = 2 then
- submit_button.enable_sensitive
- end
- end
- end
- end
- end
- submit_loan is
- --
- local
- l:LOAN
- d:DATE
- lid:STRING
- do
- if db.stock.item(enter_itemid_field.text).copies.item(enter_accessionid_field.text).is_on_loan then
- message_dialog("Sorry, that copy is already on loan")
- elseif db.stock.item(enter_itemid_field.text).copies.item(enter_accessionid_field.text).is_reference_only then
- message_dialog("That item is reference only and cannot be taken out of the library")
- elseif not(db.members.item(enter_memberid_field.text).status.is_equal("Active")) then
- message_dialog("Only active members can take out items")
- elseif db.members.item(enter_memberid_field.text).num_of_items_out >= db.loan_limit.item(db.members.item(enter_memberid_field.text).member_type) then
- message_dialog("Member at lending limit")
- else
- create d.make_now
- lid := db.next_loan_id
- create l.make(lid,enter_itemid_field.text,db.members.item(enter_memberid_field.text),db.stock.item(enter_itemid_field.text).copies.item(enter_accessionid_field.text),d,db)
- db.loans.put(l,lid)
- db.stock.item(enter_itemid_field.text).copies.item(enter_accessionid_field.text).set_on_loan(true)
- db.members.item(enter_memberid_field.text).increase_num_of_items
- message_dialog("Loan Created")
- submit_button.disable_sensitive
- enter_itemid_field.set_text("")
- enter_itemid_field.enable_sensitive
- enter_accessionid_field.set_text("")
- enter_accessionid_field.enable_sensitive
- find_member_button.enable_sensitive
- find_item_button.enable_sensitive
- enter_memberid_field.enable_sensitive
- last_name_field.set_text("")
- dob_field.set_text("")
- member_type_field.set_text("")
- available.disable_select
- found := 0
- end
- end
- search_loan is
- -- Called by `select_actions' of `search_loan_button'.
- local
- types: ARRAY [STRING]
- do
- show_loan_frame.wipe_out
- show_loan_frame.extend(search_layout)
- renew_loan_button.disable_sensitive
- returns_loan_button.disable_sensitive
- create types.make(1,3)
- types.put("Member ID",1)
- types.put("Reference No. (ISBN, ISSN,ect)",2)
- types.put("Accession no.",3)
- search_combo.set_strings(types)
- search_button.select_actions.extend (agent search_for_loan)
- clear_button.select_actions.extend (agent search_loan)
- end
- search_for_loan is
- local
- search_field,search_text:STRING
- regexp:RX_PCRE_REGULAR_EXPRESSION
- -- b:BOOK
- --
- do
- search_text := search_info_field.text
- search_field := search_combo.text
- create regexp.make
- regexp.set_caseless (true)
- regexp.compile(search_text)
- check
- is_compiled: regexp.is_compiled
- end
- show_loan_frame.wipe_out
- show_loan_frame.extend(list_loan_layout)
- if search_field.is_equal("Member ID") then
- from
- db.loans.start
- until
- db.loans.off
- loop
- regexp.match(db.loans.item_for_iteration.member.memberid)
- if regexp.has_matched then
- loan_list.extend(db.loans.item_for_iteration.row_representation)
- end
- db.loans.forth
- end
- elseif search_field.is_equal("Reference No. (ISBN, ISSN,ect)") then
- from
- db.loans.start
- until
- db.loans.off
- loop
- regexp.match(db.stock.item(db.loans.item_for_iteration.itemid).reference_number)
- if regexp.has_matched then
- loan_list.extend(db.loans.item_for_iteration.row_representation)
- end
- db.loans.forth
- end
- elseif search_field.is_equal("Accession no.") then
- from
- db.loans.start
- until
- db.loans.off
- loop
- regexp.match(db.loans.item_for_iteration.item.accession_number)
- if regexp.has_matched then
- loan_list.extend(db.loans.item_for_iteration.row_representation)
- end
- db.loans.forth
- end
- end
- set_loan_column_names
- end
- list_loan is
- -- Called by `select_actions' of `list_loans_button'.
- do
- show_loan_frame.wipe_out
- show_loan_frame.extend(list_loan_layout)
- renew_loan_button.disable_sensitive
- returns_loan_button.disable_sensitive
- from
- db.loans.start
- until
- db.loans.off
- loop
- loan_list.extend(db.loans.item_for_iteration.row_representation)
- db.loans.forth
- end
- set_loan_column_names
- end -- list_loan
- item_on_loan_list_selected(an_item: EV_MULTI_COLUMN_LIST_ROW) is
- --
- do
- renew_loan_button.enable_sensitive
- returns_loan_button.enable_sensitive
- end
- item_on_loan_list_deselected(an_item: EV_MULTI_COLUMN_LIST_ROW) is
- --
- do
- renew_loan_button.disable_sensitive
- returns_loan_button.disable_sensitive
- end
- list_finished_loan is
- do
- show_loan_frame.wipe_out
- show_loan_frame.extend(list_finished_loan_layout)
- renew_loan_button.disable_sensitive
- returns_loan_button.disable_sensitive
- from
- db.finished_loans.start
- until
- db.finished_loans.off
- loop
- finished_loan_list.extend(db.finished_loans.item_for_iteration.row_representation)
- db.finished_loans.forth
- end
- set_finished_loan_column_names
- end
- renew_loan is
- -- Called by `select_actions' of `returns_loan_button'.
- do
- -- renew loan
- if loan_list.selected_item /= void then
- if db.loans.item(loan_list.selected_item.i_th(1)).renew_count /= 3 then
- db.loans.item(loan_list.selected_item.i_th(1)).increase_renew_count
- db.loans.item(loan_list.selected_item.i_th(1)).return_date.day_add((db.loan_duration.item(db.loans.item(loan_list.selected_item.i_th(1)).member.member_type) / 4).truncated_to_integer)
- list_loan
- else
- message_dialog("The maximum loan duration for this member type has been met. You canoot renew this item any more.")
- end
- end
- end
- returns_loan is
- -- Called by `select_actions' of `returns_loan_button'.
- local
- f:FINISHED_LOAN
- d:DATE
- do
- -- returns loan
- if loan_list.selected_item /= void then
- create d.make_now
- -- create f.make(db.loans.item(loan_list.selected_item.i_th(1)).id,db.loans.item(loan_list.selected_item.i_th(1)).member.memberid,db.loans.item(loan_list.selected_item.i_th(1)).item_id,db.loans.item(loan_list.selected_item.i_th(1))
- create f.make(db.loans.item(loan_list.selected_item.i_th(1)).id,db.loans.item(loan_list.selected_item.i_th(1)).member.memberid,db.loans.item(loan_list.selected_item.i_th(1)).itemid,db.loans.item(loan_list.selected_item.i_th(1)).item.accession_number,db.loans.item(loan_list.selected_item.i_th(1)).start_date,d,db.loans.item(loan_list.selected_item.i_th(1)).renew_count,db)
- --create f.make()
- db.finished_loans.put(f,db.loans.item(loan_list.selected_item.i_th(1)).id)
- db.loans.item(loan_list.selected_item.i_th(1)).item.set_on_loan(false)
- db.loans.remove(db.loans.item(loan_list.selected_item.i_th(1)).id)
- db.members.item(loan_list.selected_item.i_th(7)).decrease_num_of_items
- list_loan
- end
- end
- lending_rights is
- -- Called by `select_actions' of `lending_rights_button'
- do
- show_loan_frame.wipe_out
- show_loan_frame.extend(lending_rights_layout)
- a_loan_limit.set_text(db.loan_limit.item("Administrator").out)
- s_loan_limit.set_text(db.loan_limit.item("Staff").out)
- u_loan_limit.set_text(db.loan_limit.item("Undergraduate").out)
- p_loan_limit.set_text(db.loan_limit.item("Postgraduate").out)
- v_loan_limit.set_text(db.loan_limit.item("Visitor").out)
- a_duration.set_text(db.loan_duration.item("Administrator").out)
- s_duration.set_text(db.loan_duration.item("Staff").out)
- u_duration.set_text(db.loan_duration.item("Undergraduate").out)
- p_duration.set_text(db.loan_duration.item("Postgraduate").out)
- v_duration.set_text(db.loan_duration.item("Visitor").out)
- submit_button.select_actions.extend (agent amend_lending_rights)
- end
- amend_lending_rights is
- --
- do
- if not(validate("^[0-9]+$",a_loan_limit.text,false)) then
- message_dialog("Invalid administrator loan limit")
- elseif not(validate("^[0-9]+$",s_loan_limit.text,false)) then
- message_dialog("Invalid Staff loan limit")
- elseif not(validate("^[0-9]+$",u_loan_limit.text,false)) then
- message_dialog("Invalid undergraduate loan limit")
- elseif not(validate("^[0-9]+$",p_loan_limit.text,false)) then
- message_dialog("Invalid postgraduate loan limit")
- elseif not(validate("^[0-9]+$",v_loan_limit.text,false)) then
- message_dialog("Invalid visitor loan limit")
- elseif not(validate("^[0-9]+$",a_duration.text,false)) then
- message_dialog("Invalid administrator loan duration")
- elseif not(validate("^[0-9]+$",s_duration.text,false)) then
- message_dialog("Invalid staff loan duration")
- elseif not(validate("^[0-9]+$",u_duration.text,false)) then
- message_dialog("Invalid undergraduate loan duration")
- elseif not(validate("^[0-9]+$",p_duration.text,false)) then
- message_dialog("Invalid postgraduate loan duration")
- elseif not(validate("^[0-9]+$",v_duration.text,false)) then
- message_dialog("Invalid visitor loan duration")
- else
- db.loan_limit.replace(a_loan_limit.text.to_integer,"Administrator")
- db.loan_limit.replace(s_loan_limit.text.to_integer,"Staff")
- db.loan_limit.replace(u_loan_limit.text.to_integer,"Undergraduate")
- db.loan_limit.replace(p_loan_limit.text.to_integer,"Postgraduate")
- db.loan_limit.replace(v_loan_limit.text.to_integer,"Visitor")
- db.loan_duration.replace(a_duration.text.to_integer,"Administrator")
- db.loan_duration.replace(s_duration.text.to_integer,"Staff")
- db.loan_duration.replace(u_duration.text.to_integer,"Undergraduate")
- db.loan_duration.replace(p_duration.text.to_integer,"Postgraduate")
- db.loan_duration.replace(v_duration.text.to_integer,"Visitor")
- message_dialog("Lending rights updated!")
- end
- -- only by an administrator
- end
- loans_overdue is
- --
- do
- show_loan_frame.wipe_out
- show_loan_frame.extend(list_loan_layout)
- from
- db.loans.start
- until
- db.loans.off
- loop
- if db.loans.item_for_iteration.is_overdue then
- loan_list.extend(db.loans.item_for_iteration.row_representation)
- end
- db.loans.forth
- end
- set_loan_column_names
- end
- exit_loan is
- -- Called by `select_actions' of `exit_loans_button'.
- local
- pixmap:EV_PIXMAP
- do
- create pixmap
- show_loan_frame.wipe_out
- pixmap.set_with_named_file (".\library.png")
- show_loan_frame.extend(pixmap)
- end
- g_list_current_loans(s:STRING) is
- --
- do
- show_loan_frame.wipe_out
- show_loan_frame.extend(list_loan_layout)
- renew_loan_button.disable_sensitive
- returns_loan_button.disable_sensitive
- from
- db.loans.start
- until
- db.loans.off
- loop
- if db.loans.item_for_iteration.member.memberid.is_equal(s) then
- loan_list.extend(db.loans.item_for_iteration.row_representation)
- end
- db.loans.forth
- end
- set_loan_column_names
- end -- list_loan
- g_list_finished_loans(s:STRING) is
- --
- do
- show_loan_frame.wipe_out
- show_loan_frame.extend(list_finished_loan_layout)
- renew_loan_button.disable_sensitive
- returns_loan_button.disable_sensitive
- from
- db.finished_loans.start
- until
- db.finished_loans.off
- loop
- if db.finished_loans.item_for_iteration.member_id.is_equal(s) then
- finished_loan_list.extend(db.finished_loans.item_for_iteration.row_representation)
- end
- db.finished_loans.forth
- end
- set_finished_loan_column_names
- end
- feature --Reservation Functions
- create_reservation is
- -- Called by `select_actions' of `create_reservation_button'.
- do
- show_reservation_frame.wipe_out
- show_reservation_frame.extend(create_reservation_layout)
- find_member_button.select_actions.extend (agent find_member)
- find_item_button.select_actions.extend (agent find_item)
- reserve_button.select_actions.extend (agent reserve)
- clear_button.select_actions.extend (agent create_reservation)
- end
- reserve is
- -- local
- -- l:LOAN
- -- d:DATE
- -- rid:STRING
- do
- -- if db.stock.item(enter_itemid_field.text).copies.item(enter_accessionid_field.text).is_available then
- -- message_dialog("There is an available copy in the library")
- -- else
- -- create d.make_now
- -- rid := db.next_reservations_id
- -- create l.make(rid,enter_itemid_field.text,db.members.item(enter_memberid_field.text),db.stock.item(enter_itemid_field.text).copies.item(enter_accessionid_field.text),d,db)
- -- db.reservations.put(l,rid)
- -- db.reservations.item(enter_itemid_field.text).copies.item(enter_accessionid_field.text).set_on_reservations(true)
- -- end
- end -- reserve
- cancel_reservation is
- -- Called by `select_actions' of `cancel_reservation_button'.
- do
- end
- search_reservation is
- -- Called by `select_actions' of `search_reservation_button'.
- do
- end
- list_reservation is
- -- Called by `select_actions' of `list_reservation_button'.
- do
- end
- exit_reservation is
- -- Called by `select_actions' of `exit_reservation_button'.
- local
- pixmap:EV_PIXMAP
- do
- create pixmap
- show_reservation_frame.wipe_out
- pixmap.set_with_named_file (".\library.png")
- show_reservation_frame.extend (pixmap)
- end -- exit_reservation
- feature --Loan Functions
- add_fine is
- -- Called by `select_actions' of `add_fine_button'.
- do
- end
- pay_fine is
- -- Called by `select_actions' of `pay_fine_button'.
- do
- end
- amend_fine is
- -- Called by `select_actions' of `amend_fines_button'.
- do
- end
- list_fine is
- -- Called by `select_actions' of `list_fines_button'.
- do
- end
- feature --Other Functions
- load_system is
- do
- db.load
- end
- save_system is
- do
- db.save
- end
- exit_system is
- --
- do
- hide
- create login
- login.show
- end
- show_about_box is
- --
- local
- about_dialog: EV_INFORMATION_DIALOG
- do
- create about_dialog.make_with_text (" Library System%N by: %N Eif' had a Vision2")
- about_dialog.set_title("About Library")
- about_dialog.show_modal_to_window (Current)
- end
- reports is
- --
- local
- reports_dialog: EV_INFORMATION_DIALOG
- do
- create reports_dialog.make_with_text ("Not yet functional")
- reports_dialog.set_title("Reports")
- reports_dialog.show_modal_to_window (Current)
- end
- letters is
- --
- local
- letters_dialog: EV_INFORMATION_DIALOG
- do
- create letters_dialog.make_with_text ("Not yet functional")
- letters_dialog.set_title("Letters")
- letters_dialog.show_modal_to_window (Current)
- end
- login:LOGIN_BOX
- end -- class MAIN_WINDOW
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement