2018-03-21 10:08:59 +00:00
|
|
|
module.exports = function(Self) {
|
|
|
|
Self.validateBinded('quantity', validateQuantity, {
|
2018-04-04 14:41:06 +00:00
|
|
|
message: 'Enter an integer different to zero',
|
2018-03-21 10:08:59 +00:00
|
|
|
allowNull: false,
|
|
|
|
allowBlank: false
|
|
|
|
});
|
|
|
|
|
|
|
|
function validateQuantity(quantity) {
|
2018-03-21 13:54:12 +00:00
|
|
|
return !isNaN(quantity) && quantity != 0;
|
2018-03-21 10:08:59 +00:00
|
|
|
}
|
|
|
|
|
2018-08-17 12:53:25 +00:00
|
|
|
Self.validatesPresenceOf('packagingFk', {message: 'The package cannot be blank'});
|
2018-03-21 10:08:59 +00:00
|
|
|
};
|