returnrun_sql("SELECT COUNT(*) FROM sbmCPLXAPPROVAL WHERE doctype=%s AND categ=%s AND status=%s AND type=%s",(doctype,categ,status,apptype,))[0][0]
def__db_get_infos(key):
returnrun_sql("SELECT status,id_group,id_bskBASKET,id_EdBoardGroup,dFirstReq,dLastReq,dEdBoardSel,dRefereeSel,dRefereeRecom,dEdBoardRecom,dPubComRecom,dProjectLeaderAction FROM sbmCPLXAPPROVAL WHERE rn=%s and type=%s",key)
def__db_set_EdBoardSel_time(key):
run_sql("UPDATE sbmCPLXAPPROVAL SET dEdBoardSel=NOW() WHERE rn=%s and type=%s",key)
users1=run_sql("""SELECT id, email FROM user WHERE email<>'' AND email RLIKE %s ORDER BY email """,(email_user_pattern,))
exceptOperationalError:
users1=()
# users that are connected
try:
users2=run_sql("""SELECT DISTINCT u.id, u.email
FROM user u LEFT JOIN user_usergroup ug ON u.id = ug.id_user
WHERE u.email<>'' AND ug.id_usergroup = %s AND u.email RLIKE %s
ORDER BY u.email """,(id_EdBoardGroup,email_user_pattern))
exceptOperationalError:
users2=()
# no users that match the pattern
ifnot(users1orusers2):
stopon1='<p>%s</p>'%_("no qualified users, try new search.")
eliflen(users1)>MAXSELECTUSERS:
stopon1='<p><strong>%s%s</strong>, %s (%s%s)</p>'%(len(users1),_("hits"),_("too many qualified users, specify more narrow search."),_("limit"),MAXSELECTUSERS)
users1=run_sql("""SELECT id, email FROM user WHERE email <> "" AND email RLIKE %s ORDER BY email """,(email_user_pattern,))
exceptOperationalError:
users1=()
# no users that match the pattern
ifnotusers1:
stopon1='<p>%s</p>'%_("no qualified users, try new search.")
eliflen(users1)>MAXSELECTUSERS:
stopon1='<p><strong>%s%s</strong>, %s (%s%s)</p>'%(len(users1),_("hits"),_("too many qualified users, specify more narrow search."),_("limit"),MAXSELECTUSERS)
# show matching users
else:
users=[]
for(user_id,email)inusers1:
users.append([user_id,email,''])
try:id_user=int(id_user)
exceptValueError:pass
# user selected already connected to role
email_out=acc_get_user_email(id_user)
# a user is selected
ifemail_out:
stopon2="""<p>user <strong>%s</strong> will be the referee ?
t=websubmit_templates.tmpl_publiline_displaywritecomment(doctype,categ,RN,apptype,action,_("Take a decision"),TEXT_ProjectLeaderDecision_MSG_SUBJECT,validation,"",ln)
Scientific Note approval for document %s has been submitted to the CERN Document Server.
Your approval is requested for this document. Once you have received recommendations from both the referee and the publication committee chair, you will be able to make your decision.
Requested subcategory: %s
Title: %s
Author(s): %s
To access the document(s), select the file(s) from the location:
<%s/%s/%s>
The %s has made a recommendation for the document. He/she said the following:
%s
You can approve this document by visiting this page:
<%s>
You can also check the status of the document from: