Function Documentation: |
This function's task is to generate a SECONDARY report number.
Some document types require more than one report number. The function
"Report_Number_Generation" should be used to generate the PRIMARY
report number (for various reasons, including the fact that that
function populates the global "rn" with the document's main report
number). This function then, should be used to generate the secondary
report number.
This function doesn't populate any global variable with the secondary
report number, meaning that it should only be called if a secondary
report number actually needs to be generated by the system (i.e. not
if the user is to supply this secondary report number via the submission
form.
A use case for this function could be when a document is approved as
an official note of some sort. Before approval for example, it could
be classed as a Communication and have its own "Communication number".
At approval time however, it could be given a new "official note"
number, and this function could be used to generate the new number.
So in short, the function behaves rather like Report_Number_Generation
and was infact based upon that function. It:
+ Creates a "report number" according to some format and using some
counter files.
+ Writes that new "report number" to a file in the submission's
working directory.
(** If the "second report number" file already exists in the
submission's working directory, it merely exits silently.)
Parameters:
@param 2nd_counterpath: (string) - the path to the counter file that
is used to create the report number.
The counter path can make use of in order to specify
some value that should be included in the path:
yy --> Include the year in the path
categ --> Include the submission's category in the path.
file[re]:name_of_file[regular expression to match] -->
Include the first line of file (in curdir), matching [re]
file*[re]:name_of_file [regular expression to match] -->
Include all the lines of a file (in curdir), matching [re]
separated by - (dash) char.
@param 2nd_rn_file: (string) - the name of the file that is to be
created containing the secondary report number. The file will be
created in the submission's working directory.
@param 2nd_rn_format: (string) - The format according to which the
secondary report number will be created.
@param 2nd_rncateg_file: (string) - the name of the file (in the
submission's working directory) that contains the category of the
document.
The value in this file can be put into the report number by
including categ anywhere that it is needed in the report-
number format.
@param 2nd_rn_yeargen: (string) - the instruction used for generating
the year if one is to be used in the report number.
The parameter should take either the value "AUTO" - in which case
the year component of the report number will be a 4-digit
representation for the current year - or - the name of a file in
the submission's working directory that contains the year that should
be included in the report number.
Note, if the parameter contains the name of a file, it will be assumed
that if the length of its contents is 10 chars, its value will be a
date in the format "dd/mm/yyyy" and the last 4 characters will be
taken as the year. Otherwise if the length is not 10 characters, it
will be assumed that the file simply contained a year and its
contents will be taken as-is. If the file cannot be opened, an
InvenioWebSubmitFunctionError exception will be raised. If no value
is provided for this parameter, the year in the format YYYY will be
used.
The value that is finally created using this parameter for year will
be used in the final report number anywhere that the format contains
yy.
Note:
Tages that use can take values as follows:
yy --> Include the year (as determined by 2nd_rn_yeargen).
categ --> Include the submission's category.
file[re]:name_of_file[regular expression to match] -->
Include the first line of file (in curdir), matching [re]
file*[re]:name_of_file [regular expression to match] -->
Include all the lines of a file (in curdir), matching [re]
separated by - (dash) char.
@param 2nd_nb_length: (string) the number of digits for the
report number. Eg: '3' for XXX-YYYY-025 or '4' for
XXX-YYYY-0025. If more are needed (all available digits have
been used), the length is automatically extended. Choose 1 to
never have leading zeros. Default length: 3.
@return: (string) - empty string.
@Exceptions raised: InvenioWebSubmitFunctionError - upon unexpected
error. |