Menu

Limiting hourly usage?

Help
2003-05-30
2003-08-03
  • Daniel Drucker

    Daniel Drucker - 2003-05-30

    I am adapting ORS for use within my organization (University of Pennsylvania). I need to add one particular feature - I need to be able to track and limit the number of hours each user books. For instance, one user might only be able to book a total of 30 hours per month on a resource.

    Any suggestions on how to go about doing this?

     
    • Jeremy Shaver

      Jeremy Shaver - 2003-06-02

      You would have to do two things:

      (1) add a new field to the userlist.csv file which contained the # of hours the user was permitted to sign up for. This involves modifying functions.php getusers function (in which you can add another "default" field to the ones it already looks for - something like $users['totalhours']) and also edit the edituser section of utilities.php to allow an admin to edit the value. You can easily add this code just above or below the code which sets resource access permissions.

      and (2) you have to add a rule to the validatesignups function in functions.php. Take a look at the last rule test which looks at each signup of a given user and verifies that none of the signups go over the allowed length for the given resource. You can simply add another, similar, loop which tests if the sum of the signups goes over that user's alloted amount.
      -Jeremy

       
      • Daniel Drucker

        Daniel Drucker - 2003-06-02

        That looks like it would apply to ALL resources; I need to be able to assign different numbers of allowed hours to different resources - for instance, user "george" may schedule 40 hours/month on resource FOO and 20 hours/month on resource BAR.

         
        • Jeremy Shaver

          Jeremy Shaver - 2003-06-03

          No big deal. You just need to specify a limit for each resource. I'd probably do it in a single field (see, for example, the resourceblock field - it handles allow/disallow for each resource by using a binary string.)

          If you have fixed "levels" of access (20, 30, 40 hours), you could do something similar. A code of:

             0131

          (1=20, 3=40) might mean that resource 1 has a zero hour limit, resource 2 has a 20 hour limit (1=20), resource 3 has a 40 hour limit and 4 has a 20 hour limit.

           
          • Daniel Drucker

            Daniel Drucker - 2003-06-03

            If you have the time, could you expand on this a little bit? I'm having some trouble understanding how this would work.

             
    • Jeremy Shaver

      Jeremy Shaver - 2003-08-03

      General message: For people interested in being able to limit total resource signup time on a user-by-user basis, we have developed a solution. Although it is not yet included in the released (or beta) versions of the ORS, we can give some guidence on getting it set up for custom installations of ORS.

      Write me directly: jshaver@users.sourceforge.net

      -Jeremy

       

Log in to post a comment.