From de382a6eb5e6fe66532c703dba717715d44491a9 Mon Sep 17 00:00:00 2001 From: VerySoft Date: Sat, 26 Nov 2022 15:39:28 -0500 Subject: [PATCH] Buffs library book management These are mostly copy pasta edits of things that already work, however, I do not know how to set up a database on my test server, so! These tools have not been tested beyond compiling and running and seeing that the window pops up. They work the same way as the existing method of book deletion though, so there's little reason to think they will do anything especially differently. --- code/game/magic/archived_book.dm | 51 ++++++++++++++++------- code/modules/admin/admin_verb_lists_vr.dm | 3 +- code/modules/library/lib_machines.dm | 40 +++++++++++++++++- 3 files changed, 77 insertions(+), 17 deletions(-) diff --git a/code/game/magic/archived_book.dm b/code/game/magic/archived_book.dm index 1aab354815a..ea484584df1 100644 --- a/code/game/magic/archived_book.dm +++ b/code/game/magic/archived_book.dm @@ -39,25 +39,46 @@ var/global/datum/book_manager/book_mgr = new() if(!src.holder) to_chat(src, "Only administrators may use this command.") return +//VOREStation Edit Start + var/obj/machinery/librarycomp/our_comp + for(var/obj/machinery/librarycomp/l in world) + if(istype(l, /obj/machinery/librarycomp)) + our_comp = l + break - var/isbn = tgui_input_number(usr, "ISBN number?", "Delete Book") - if(!isbn) + if(!our_comp) + to_chat(usr, "Unable to locate a library computer to use for book deleting.") return - if(BOOKS_USE_SQL && config.sql_enabled) - var/DBConnection/dbcon = new() - dbcon.Connect("dbi:mysql:[sqldb]:[sqladdress]:[sqlport]","[sqllogin]","[sqlpass]") - if(!dbcon.IsConnected()) - tgui_alert_async(usr, "Connection to Archive has been severed. Aborting.") - return + var/dat = "Book Inventory Management\n" // + dat += "

ADMINISTRATIVE MANAGEMENT

" + establish_old_db_connection() + + if(!dbcon_old.IsConnected()) + dat += "ERROR: Unable to contact External Archive. Please contact your system administrator for assistance." else - var/DBQuery/query = dbcon.NewQuery("DELETE FROM library WHERE id=[isbn]") - if(!query.Execute()) - to_chat(usr,query.ErrorMsg()) - dbcon.Disconnect() - else - book_mgr.remove(isbn) - log_admin("[usr.key] has deleted the book [isbn]") + dat += {"(Order book by SS13BN)

+ +
TITLE + + dat += "

ADMINISTRATIVE MANAGEMENT

" + establish_old_db_connection() + + if(!dbcon_old.IsConnected()) + dat += "ERROR: Unable to contact External Archive. Please contact your system administrator for assistance." + else + dat += {"
(Order book by SS13BN)

+ + " + dat += "
TITLE\[Del\]" + dat += "
" + dat += "
(Return to main menu)
" + + user << browse(dat, "window=library") + onclose(user, "library") +//VOREStation Addition End + /obj/machinery/librarycomp/emag_act(var/remaining_charges, var/mob/user) if (src.density && !src.emagged) src.emagged = 1 @@ -460,6 +497,7 @@ else var/DBQuery/query = dbcon_old.NewQuery("DELETE FROM library WHERE id=[sqlid]") query.Execute() + log_admin("[usr.key] has deleted the book [sqlid]") //VOREStation Addition if(href_list["orderbyid"]) var/orderid = tgui_input_number(usr, "Enter your order:") @@ -571,4 +609,4 @@ b.icon_state = "book[rand(1,7)]" qdel(O) else - ..() \ No newline at end of file + ..()