# File: $WDL/modules_kgs/transactions/views/main.cfm # # 01/14/24 kkl Initial draft # Status: I did the work below to create the module and to get it "working" 1. The Excel button doesn't work - duplicate all the logic in ACTIONS. . You'll heed to add excel() to the handler. . Change the
action for the Excel button to this: . Then this gets messy. Eileen has a cool new way to build a spreadsheet coded in legacy.cfm We would probably want to move that code into views/excel.cfm. I decided to stop at this point. I think the accountants need all the formatting Eileen has done. I would like to add nwrap styling to all the columns like I did in ACTIONS. #row.time# 2. Show query result set & form values? Look at ACTIONS and see I am now just dumping the "prc". 3. Test, test,test... 4. Cut over to ColdBox fully I've left all the ACTIONS files in the views directory for TRANSACTIONS. I think that basic framework will work for TRANSACTIONS so start cutting over legacy.cfm into main.cfm, top.cfm, and bottom.cfm. The other files get included by the upper level files (top, bottom). ~/wdltest/modules_kgs/transactions/views>ls -l -rw-rw-r--@ 1 kurtlook HOME\Domain Users 793 Jan 14 08:57 bottom.cfm -rw-r--r--@ 1 kurtlook HOME\Domain Users 3182 Jan 14 08:57 bottom_query.cfm -rw-r--r--@ 1 kurtlook HOME\Domain Users 3131 Jan 14 08:57 bottom_table.cfm -rw-r--r--@ 1 kurtlook HOME\Domain Users 2104 Jan 14 08:57 excel.cfm -rw-r--r--@ 1 kurtlook HOME\Domain Users 3567 Jan 14 08:57 excel.cfm.001 -rwxr--r--@ 1 kurtlook HOME\Domain Users 24159 Jan 14 11:38 legacy.cfm drwxrwxr-x@ 6 kurtlook HOME\Domain Users 192 Jan 14 09:31 library.deprecated -rw-r--r--@ 1 kurtlook HOME\Domain Users 1607 Jan 14 11:21 main.cfm -rwxr--r--@ 1 kurtlook HOME\Domain Users 20294 Jan 14 09:32 superuser.cfc -rw-rw-r--@ 1 kurtlook HOME\Domain Users 4143 Jan 14 08:57 top.cfm # # 01/14/24: Created the kolar_kgs/transactions module # . Copy actions -> transactions (actions is set up already) mkdir /modules_kgs/transactions cd /modules_kgs_transactions cp -r ../actions/* . . Edit 'action' => 'transaction' . Confirm ModulConfig.cfc is good . Confirm handlers Leave all the actions code there - just comment out what is not needed You'll want example code to modify. . Look at layouts but don't do anything yet . Look at models quickly - nothing to do yet . Views is where things heat up. Go into /views/library.deprecated and copy in all the 'transactions' related files from /library (Eileen's code) > rm actions.* Edit library.sh to copy in /library files You'll get transactions.cfm that you will need. I left wdl.css for now. Copy transactions.cfm to views/legacy.cfm alongside main.cfm, etc. Do this in main.cfc so we only run the legacy code. ... . In /includes/menu/items/transactions.cfm, make sure this line looks like this. This will get you into the handler, model, view for 'transactions'. . Run it Got through handlers just fine. Blowing up in the model trying to run 'actions' code. Go comment all the actions code out. I problably should have done this above in the model before we got here. . I then got into legacy.cfm, Eileen's code w/o much pain. . Now we started trying to make the legacy code run as is. We'll need to change everything having to do with the URL and FORM scopes at a minimum. Edit: session.userid => session.user.user_id session.superuser => session.user.superuser #data_source# => #application.dsn# At this point, it tried to load the 'superuser.cfc' component. Double back and add this to views/library.deprecated/library.sh to get that file to look at Then copy this file into /views next to legacy.cfm. > cp library.deprecated/superuser.cfc . This got me to line 283 where a URL variable was referenced. This requires a few changes Edit submit => prc.submit in legacy.cfm Then we have to go to the handler (main.cfc) and load the URL variable into "prc". You'll find the code is already there from the 'actions' module we started with. I also deleted a handler that will not be needed in transactions to start the incremental cleanup of the old actions code. Then I put a dump/abort in main.index() to see if we are getting the 'rc' we expect. SUBMIT was not in the 'rc' but at this point, it wouldn't be. We just set prc.submit='' in the handler. With that in place, we should move past issues with 'submit'. I got back to legacy.cfm and found a 2nd 'submit' at line #521. I mentioned this to demonstrate we're marching down the file methodically. So edit: submit => prc.submit At this point, the page came up and I was able to interact with it. Died at 353 looking at a FORM scope variable (#form.page#). We need to do the handler round trip editing we did above, adding 'page' to the prc in the handler. Edit #page# => #prc.page# in legacy.cfm. Then I hit an undefined variable 'format' at line #485. At this point I think this might be a form variable that we could see in the 'rc' in the handler. I'm going to turn on the writeDump at the top of the handler main.index() to see the 'rc'. The page came up with the dump shown, but this is only the 'rc' loading the page the first time. I clicked the 'search' button and got the writeDump I wanted, seeing these FIELDNAMES coming in via the URL/FORM scopes: USER_ID,USER_NAME,ROLE,TRANSACTION_TYPE_CODE,NOW,SUBMIT I'll now add these to the "prc" in the main.index() handler. We're up do numerous things in the "prc": if (isDefined('rc.submit' )) { prc.submit = rc.submit; } else { prc.submit = ''; } if (isDefined('rc.page' )) { prc.page = rc.page; } else { prc.page = ''; } if (isDefined('rc.user_id' )) {prc.user_id = rc.user_id } else { prc.user_id = '';} if (isDefined('rc.user_name' )) {prc.user_name = rc.user_name } else { prc.user_name = '';} if (isDefined('rc.role' )) {prc.role = rc.role } else { prc.role = '';} if (isDefined('rc.transaction_type_code')) {prc.transaction_type_code = rc.transaction_type_code} else { prc.transaction_type_code = '';} if (isDefined('rc.now' )) {prc.now = rc.now } else { prc.now = '';} It is still complaining about an undefined variable 'format' that I can't find. I'm killing a huge chunk of commented out code in the middle so I could reduce the grep results. This will change line numbers from here on out. There was a problem with the WDL.TRANSACTIONS query. Both 'format' and 'document_id' were missing from the query. I cannot explain this other than maybe this menu item is not used. I moved this query into the main.cfc model. This page started working. Now I'm tweaking. I put the menu at the top I had to wrap the

Search Transactions

with this:
...
Otherwise, this

is at the end of the menu.