New City Guide website

Horisk have just completed development on a new series of city guide websites - the go-out-in sites which range from Go Out In Bath to Go Out In York, covering sixteen cities in all including Go Out In Glasgow, Go Out In Manchester and the biggest of them all Go Out In London.

The family of sites provide reviews and listings for everything from Edinburgh restaurant reviews to pubs in Liverpool, live music in Nottingham, theatres in Oxford, cinemas in Cardiff and shopping in Sheffield.

The site was developed in Coldfusion 8, and uses a Filemaker Pro Content Management System to allow non-technical editorial staff to manage the reviews and listings, advertising banners and other content.

When Filemaker Privileges are not enough

Normally adjusting Filemaker privileges for user groups is enough to embed the required security into your solution. You can achieve most things through the usual granular access to script, layout, record and value list privileges.

Sometimes this isn't enough though. What if you have an action that can only be performed by a user if they are a member of a given privilege set OR they conform to a rule that is based on the content of the record being viewed?

I recently had a request from a client to add a process into our Deadline solution for publishers that I just couldn't achieve with the privileges alone. Fortunately, as with most things Filemaker, the solution turned out to be pretty simple. The issue I was presented with relates to advertising sales orders. The client has a process whereby any salesperson can create an order in the software but all orders need to be passed by a sales manager before they can be issued to the client. In addition to this there is a rule that only the person who created the order or a sales manager can make alterations to any part of the order. Initially it seems straight forward...

1. Put the sales manager in a privilege set that allows access to an edit order screen

2. Put sales people in privilege set that does not allow access to the edit screen

The problem is though that this means the sales person who 'owns' the order can no longer edit it. The solution is really simple.

As moving to the edit screen will always require a button press I could create an authorization script to check that the user is allowed to edit that record.

The script (check_authorization) looks like this.

SetVariable[$priv; Value:Get(PrivilegeSetName)]
SetVariable[$user; Value:Get(AccountName)]
If[PatternCount(Get(ScriptParameter);$priv) or PatternCount(Get(ScriptParameter);$user)
SetVariable [$auth;Value:"Yes"]
Else
SetVariable [$auth;Value:"No"]
Show Custom Dialog ["Access Denied";"You are not allowed to do this"]
End If
Exit Script [Result:$auth]

The first two lines (SetVariable) identify the current user account and the privilege set they belong to. Not strictly necessary to do this here but I like to set up variables with more sensible names to use inside a script, at the very least I find it makes the script easier to read.

The next statement (the If) is where the decision is made. The button the user clicked to activate the script has a parameter attached and that parameter contains the account names and or privilege set names in a return separated list of individuals who are allowed to perform this action. In this case it contains

Sales_manager
ileslie

i.e. the privilege set name that is allowed to perform the action and the contents of the 'sold_by' field on the current order form being viewed. The script then compares the variables I set for $priv and $user with the script parameter and if there is a match it sets the result to 'Yes'. If there is no match it sets the result to 'No' and displays a dialog.

On exit the script returns the parameter $auth (either 'Yes' or 'No').

The reason for this is to allow this script to be called from within another script and return it the result before proceeding.

A simple example would be

Perform Script ["check_authorization";Parameter:Get(ScriptParameter)
If[Get(ScriptResult) = "Yes"]
Go to Layout ["edit_order"]
End If

So I now have a simple script that can check a users authorization to run any script or action even when the authorization depends on the content of the record being viewed.

New plant database for landscaping professionals

Horisk recently completed some behind-the-scenes work linking Filemaker Pro and MySQL databases on a new website ilexplants.co.uk for Ilex Creative Solutions.

Ilex Plants WebsiteThe website consists of an extensive database of plants for Garden Designers and Landscape Architects. This will help professionals in the industry search for and select plants based on their suitability for the conditions or situation required by their Landscape Project, whether that be design considerations (plant size, flower colour, leaf type) or site conditions such as soil structure, pH, location (coastal or urban) etc.

The database of plants was originally developed in Filemaker Pro, and Horisk's initial job was to setup a hosted version of this database so that a number of experts around the country could collaborate on preparing the initial data. Then we developed scripts to link the Filemaker database with the online MySQL database which runs the Ilex website - this means that Ilex staff can maintain the database behind the scenes using the Filemaker tools with which they are familiar, and then instantly synchronise their changes to the live website. Effectively, Filemaker Pro is acting as an easy-to-use Content Management System (CMS) for the website.

The site is a great example of how to effectively use the External SQL Data Sources (ESS) tools in Filemaker Pro to seamlessly connect Filemaker databases to other systems. Horisk are currently using this technique to quickly build complex backend CMS for a number of websites.

5 Things to consider when making the 15% VAT Rate Change

Well that's put the cat among the pigeons.

5 working days for every retailer in the UK to change their databases, accounting systems and e-commerce websites to reflect a new VAT rate.

We've already had a couple of new customers phone us for help, either with updating their Filemaker Pro databases or Coldfusion websites to reflect the VAT rate change.

If the system has been well designed in the first place, this should be relatively straightforward. But with the VAT rate not having changed since 1991, there is always the chance that a developer has taken a shortcut and hardcoded it somewhere.

The VAT rate should be stored in one global variable that can be simply changed. Hopefully this is in a database field that the system administrator can access - but it may be buried in a preferences or application file in the code somewhere only a developer can find it. Or worse, it may have been hardcoded into calculations all over the place (as we found in one case today).

A few things to be aware of if you are about to embark on the task of changing the VAT rate yourself:

  1. If the VAT rate is stored globally, make sure the VAT rate in use at the time has been stored with historical transactions (or at least the VAT charged has been stored) - and that changing the global rate will not affect reporting of existing transactions.
  2. If the VAT rate is stored globally and is easy to change, your prices will all change appropriately. But you may decide you don't want this - what about all those £9.99s becoming £9.77 ? In this case you may not want to pass the VAT cut on to your customers. You may be able to get round this issue by doing a global search directly in your database for net prices affected and replace them with net prices multiplied by the appropriate fraction to avoid the gross price changing - a bit complicated, but definitely preferable to changing hundreds of prices by hand.
  3. If you are having to change Coldfusion or PHP code, you might just be able to do a search and replace for everywhere the existing rate is mentioned. But remember to search for all the possible variations - 17.5, 0.175, 1.175, 117.5 etc - there are lots of ways to calculate VAT... (oh yeah, and just in case your developer was particularly obtuse, 85.10638297872340425531914893617 - the fraction to work out the net price from a gross price).
  4. Before you change anything, BACKUP, BACKUP, BACKUP, and after you've made the changes, TEST, TEST, TEST.
  5. Keep a note of the changes you've made, cause you're going to need to change it all back in 13 months time...

If you think you might need a hand with any of this for a Coldfusion or PHP e-commerce website, or a Filemaker Pro database, please get in touch or leave a comment below. It looks like it's going to be a busy weekend for everybody...

BlogCFC was created by Raymond Camden. This blog is running version 5.9.002. Contact Blog Owner