feat: validar caracteres invocieIn.supplierref #6931
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
bf85aa1e9d
commit
e0cee8f559
|
@ -9,7 +9,7 @@
|
|||
},
|
||||
"vn": {
|
||||
"view": {
|
||||
"expeditionPallet_Print": "288cbd6e8289df083ed5eb1a2c808f7a82ba4c90c8ad9781104808a7a54471fb"
|
||||
"expeditionPallet_Print": "a8ea2872086aa4e3401350470b28f68d9efdbaff9fdff8c3d6b478756f7fad2a"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `util`.`string_checkPrintableAndSpanishChars`(
|
||||
vString VARCHAR(255)
|
||||
) RETURNS tinyint(1)
|
||||
DETERMINISTIC
|
||||
BEGIN
|
||||
/**
|
||||
* Validates whether the input string contains only printable characters
|
||||
* and Spanish special characters (such as ¡, ÿ, etc.).
|
||||
*
|
||||
* @vString string to check
|
||||
*/
|
||||
RETURN vString REGEXP '^[ -~¡-ÿ]*$';
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -9,6 +9,10 @@ BEGIN
|
|||
DECLARE vActive TINYINT;
|
||||
DECLARE vWithholdingSageFk INT;
|
||||
|
||||
IF NOT util.string_checkPrintableAndSpanishChars(NEW.supplierRef) THEN
|
||||
CALL util.throw('The invoiceIn cannot contain special characters');
|
||||
END IF;
|
||||
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
|
||||
SELECT withholdingSageFk INTO vWithholdingSageFk
|
||||
|
|
|
@ -3,9 +3,12 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceIn_beforeUpdat
|
|||
BEFORE UPDATE ON `invoiceIn`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
|
||||
DECLARE vWithholdingSageFk INT;
|
||||
|
||||
IF NOT (NEW.supplierRef <=> OLD.supplierRef) AND NOT util.string_checkPrintableAndSpanishChars(NEW.supplierRef) THEN
|
||||
CALL util.throw('The invoiceIn cannot contain special characters');
|
||||
END IF;
|
||||
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
|
||||
IF (SELECT COUNT(*) FROM vn.invoiceIn
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
-- Place your SQL code here
|
Loading…
Reference in New Issue