def submit(self): """ Submits the ticket using BibCatalog API. @raise Exception: if ticket creation is not successful. @return bool: True if created, False if not. """ if not self.exists(): self.ticketid = BIBCATALOG_SYSTEM.ticket_submit( subject=self.subject, queue=self.queue, text=self.body, recordid=self.recid) return True return False
def submit(self): """ Submits the ticket using BibCatalog API. @raise Exception: if ticket creation is not successful. @return bool: True if created, False if not. """ if not self.exists(): self.ticketid = BIBCATALOG_SYSTEM.ticket_submit( subject=self.subject, queue=self.queue, text=self.body, recordid=self.recid) return True return False
def submit_ticket(record, record_id): """ Submit the errors to bibcatalog """ if task_get_option("no_tickets", False): return msg = """ Bibcheck found some problems with the record with id %s: Errors: %s Amendments: %s Warnings: %s Edit this record: %s """ msg = msg % ( record_id, "\n".join(record.errors), "\n".join(record.amendments), "\n".join(record.warnings), "%s/record/%s/edit" % (CFG_SITE_URL, record_id), ) if isinstance(msg, unicode): msg = msg.encode("utf-8") subject = "Bibcheck rule failed in record %s" % record_id ticket_id = BIBCATALOG_SYSTEM.ticket_submit( subject=subject, recordid=record_id, text=subject, queue=task_get_option("queue", "Bibcheck") ) write_message("Bibcatalog returned %s" % ticket_id) if ticket_id: BIBCATALOG_SYSTEM.ticket_comment(None, ticket_id, msg)