export const FILE_STATUS_MESSAGES = {
document_already_exists: $localize`Document already exists.`,
+ asn_already_exists: $localize`Document with ASN already exists.`,
file_not_found: $localize`File not found.`,
pre_consume_script_not_found: $localize`:Pre-Consume is a term that appears like that in the documentation as well and does not need a specific translation:Pre-consume script does not exist.`,
pre_consume_script_error: $localize`:Pre-Consume is a term that appears like that in the documentation as well and does not need a specific translation:Error while executing pre-consume script.`,
MESSAGE_DOCUMENT_ALREADY_EXISTS = "document_already_exists"
+MESSAGE_ASN_ALREADY_EXISTS = "asn_already_exists"
MESSAGE_FILE_NOT_FOUND = "file_not_found"
MESSAGE_PRE_CONSUME_SCRIPT_NOT_FOUND = "pre_consume_script_not_found"
MESSAGE_PRE_CONSUME_SCRIPT_ERROR = "pre_consume_script_error"
# check not necessary in case no ASN gets set
return
if Document.objects.filter(archive_serial_number=self.override_asn).exists():
- self.log(
- "warning",
- f"A document with ASN {self.override_asn} already exists. "
- + "No ASN will be set!",
+ self._fail(
+ MESSAGE_ASN_ALREADY_EXISTS,
+ f"Not consuming {self.filename}: Given ASN already" f"exists!",
)
- self.override_asn = None
def run_pre_consume_script(self):
if not settings.PRE_CONSUME_SCRIPT: