E-Invoice - Fix a problem reported by Sin Yee on MSIC field format not exactly 5 digits in some cases

This commit is contained in:
Dillon Ngo
2025-08-22 07:30:49 +08:00
parent 4f09fa54d6
commit ef3f2bea66
3 changed files with 19 additions and 7 deletions
@@ -158,11 +158,15 @@
}
function notZero(value) {
return value !== 0 && value !== '0' && value !== null && value !== undefined
return value !== 0 && value !== '0' && value !== null && value !== undefined;
}
function fiveDigits(value) {
return /^\d{5}$/.test(value)
return /^\d{5}$/.test(value);
}
function allowZeroOrFiveDigits(value) {
return Number(value) === 0 || /^\d{5}$/.test(value);
}
export default {
@@ -246,7 +250,7 @@
},
msic_code: companyType === 1 ? {
notZero, fiveDigits
}: {},
} : { allowZeroOrFiveDigits },
}
}
},
@@ -118,11 +118,15 @@
}
function notZero(value) {
return value !== 0 && value !== '0' && value !== null && value !== undefined
return value !== 0 && value !== '0' && value !== null && value !== undefined;
}
function fiveDigits(value) {
return /^\d{5}$/.test(value)
return /^\d{5}$/.test(value);
}
function allowZeroOrFiveDigits(value) {
return Number(value) === 0 || /^\d{5}$/.test(value);
}
export default {
@@ -181,7 +185,7 @@
: {},
msic_code: isEInvoiceEnabled && companyType === 1 ? {
notZero, fiveDigits
}: {},
}: { allowZeroOrFiveDigits },
address_id: {},
street_one: isEInvoiceEnabled ? { required } : {},
@@ -10,6 +10,9 @@
<span class="btn-block" v-if="['fiveDigits'].includes(param)">
{{ errorMessages[param] }}
</span>
<span class="btn-block" v-if="['allowZeroOrFiveDigits'].includes(param)">
{{ errorMessages[param] }}
</span>
</small>
</div>
</template>
@@ -31,7 +34,8 @@
sameAs: 'this field must match the',
maxValue: 'this value must not exceeds',
alphaNum: 'this value must be alphanumeric',
fiveDigits: 'this value must be exactly 5 digits', //custom
fiveDigits: 'this value must be exactly 5 digits',
allowZeroOrFiveDigits: 'this value must be exactly 5 digits or 0',
// notZero: 'this value cannot be zero',
},
}