CAPITAL Office Business Software
CAPITAL Support Forum
FAQSearchMembersGroupsRegisterProfilePM'sLogin/Out
Detecting "Add" button click

 
Post new topic   Reply to topic    CAPITAL Office Business Software Forum Index -> Scripting & Customisation
View previous topic :: View next topic  
Author Message
coldrick



Joined: 12 Mar 2008
Posts: 61
Location: Queensland

PostPosted: Wed Apr 16, 2008 12:01 am    Post subject: Detecting "Add" button click Reply with quote

In the Customer Screen:

We want to lock out the Customer account code for users below level 8 (to prevent changes being made), but we want to allow all users the ability to add new customers and assign them a temporary account code.

Locking is no problem in Screen Builder, and we can unlock using SCRUnlock("CUSCODE"), but how can we detect if the ADD button has been clicked? Or is there another way to approach this? There doesn't seem to be a MODE to detect if a customer is being added, only if a customer has been added.

Thanks.
Back to top
View user's profile Send private message Visit poster's website
COBS Tech Support



Joined: 09 Sep 2005
Posts: 651

PostPosted: Wed Apr 16, 2008 8:59 pm    Post subject: Reply with quote

If you've given a particular user 'add' rights you cannot then prevent that user from adding a record to the system via scripting because there is no 'pre add' event that you can trap. The only thing you could do is display a warning message to explain to the user that any record changes they subsequently make will not be saved to the database. You would then block saving via the save event hook.
Back to top
View user's profile Send private message
coldrick



Joined: 12 Mar 2008
Posts: 61
Location: Queensland

PostPosted: Sun May 04, 2008 5:24 pm    Post subject: Reply with quote

FYI Solution to this problem is as follows. The last bit of code is an extra add-on which copies the billing address details to the delivery address details if the delivery address is left blank (unrelated to the problem above).

CUSCODE set to show for all security levels in Screen Builder

In CUSTOMER.MAC...

If .NOT. Security(8,FALSE)
SCRHide("CUSCODE")
Endif

* Detect adding a customer
If SCRMode() == 1
SCRShow("CUSCODE")
Endif

* Detect save event
If Mode == 3

* We want freight prompt off permanently
SCRWrite("CUSFREIASK", 'N')

* We want terms set to 0 if Credit is $0.00
If SCRRead("CUSCREDIT") = 0
SCRWrite("CUSTERMS",0)
Endif

* Add billing details to delivery details if delivery is blank
If Empty(SCRRead("CUSDNAME"))
SCRWrite("CUSDNAME", SCRRead("CUSNAME"))
SCRWrite("CUSDADD", SCRRead("CUSADDR"))
SCRWrite("CUSDADD2", SCRRead("CUSADDR2"))
SCRWrite("CUSDSUB", SCRRead("CUSSUB"))
SCRWrite("CUSDSTATE", SCRRead("CUSSTATE"))
SCRWrite("CUSDPOST", SCRRead("CUSPOST"))
SCRWrite("DELCOUNTRY", SCRRead("CUSCOUNTRY"))
EndIf

* Set default to eParcel if no carrier entered
If Empty(SCRRead("CUSCARRIER"))
SCRWrite("CUSCARRIER", 'EPARCELSTD')
Endif

Return True
Endif
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    CAPITAL Office Business Software Forum Index -> Scripting & Customisation All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

phpBB Template by Vereor
Protected by Anti-Spam ACP