Creating Print Requsitions

Print requisitions are created by the Print application. Access to this capability is controlled by the _print_submit database role. Applications written in any language can use database functions to create and submit print requisitions; for Python there is a library which provides a more Pythonic interface to these database functions.

SQL Interface

An application starts by creating a requisition using nms_create_job (). The return value is the Job ID of the print job. This is not the requisition number assigned by Graphics; that is only assigned later when the job is actually sent to Graphics.

Once the job is created, applications may set print requisition fields and attach PDF files to the job.

Setting print requisition fields is done using nms_job_set_value (job_id_p, field_code_p, field_value_p). The Job ID is the one obtained from nms_create_job (). The field code is a fairly low-level concept, corresponding to the form control ID on the Web print requisition form. The field value is the actual value to submit to the Web print requisition form. A higher level interface is provided in the Python library.

Attaching a file is done using nms_job_attach_file (job_id_p, file_code_p, file_contents_p). The Job ID is the one obtained from nms_create_job (). The file code is the filename for the file, while the file contents is simply the content of the file. Typically filenames should end in .pdf and the contents should be a PDF file.

Finally, a job may be cancelled using nms_job_cancel (job_id_p) or marked as ready for submission with nms_job_ready (job_id_p). Once the job is marked as ready for submission and transaction in which this happens commits, a regularly-scheduled process will use the information in the job to fill out a requisition. When the confirmation email comes back, the requisition number will be recorded in the database.

Python Interface

A Python interface is available in uw.local.print_.db.nms_requisition.nms_requisition.