7806_devToTest_2332 #2801

Merged
alexm merged 126 commits from 7806_devToTest_2330 into test 2024-07-30 06:14:09 +00:00
3 changed files with 28 additions and 14 deletions
Showing only changes of commit b27023cb9e - Show all commits

View File

@ -60,15 +60,17 @@ module.exports = Self => {
if (print) await Self.rawSql('CALL vn.collection_printSticker(?,NULL)', [id], myOptions); if (print) await Self.rawSql('CALL vn.collection_printSticker(?,NULL)', [id], myOptions);
for (let ticket of tickets) { for (let ticket of tickets) {
let observations = ticket.observaciones.split(' '); if (ticket.observaciones) {
let observations = ticket.observaciones.split(' ');
for (let observation of observations) { for (let observation of observations) {
const salesPerson = ticket.salesPersonFk; const salesPerson = ticket.salesPersonFk;
if (observation.startsWith('#') || observation.startsWith('@')) { if (observation.startsWith('#') || observation.startsWith('@')) {
await models.Chat.send(ctx, await models.Chat.send(ctx,
observation, observation,
$t('ticketCommercial', {ticket: ticket.ticketFk, salesPerson}) $t('ticketCommercial', {ticket: ticket.ticketFk, salesPerson})
); );
}
} }
} }
} }

View File

@ -18,7 +18,7 @@ BEGIN
AND e.id = vSelf; AND e.id = vSelf;
IF vIsEditable AND NOT IFNULL(@isModeInventory, FALSE) THEN IF vIsEditable AND NOT IFNULL(@isModeInventory, FALSE) THEN
CALL util.throw('Entry is not editable'); CALL util.throw(CONCAT('Entry ', vSelf, ' is not editable'));
END IF; END IF;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -13,20 +13,32 @@ BEGIN
* @param vBookEntry Id de asiento, si es NULL se genera uno nuevo * @param vBookEntry Id de asiento, si es NULL se genera uno nuevo
*/ */
DECLARE vFiscalYear INT; DECLARE vFiscalYear INT;
DECLARE vHasDistinctTransactions INT; DECLARE vDistinctTransactions INT;
DECLARE vHasRepeatedTransactions BOOL;
SELECT COUNT(DISTINCT transactionTypeSageFk) INTO vHasDistinctTransactions SELECT COUNT(DISTINCT iit.transactionTypeSageFk) INTO vDistinctTransactions
FROM invoiceIn ii FROM invoiceIn ii
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
JOIN invoiceInSerial iis ON iis.code = ii.serial JOIN invoiceInSerial iis ON iis.code = ii.serial
WHERE ii.id = vSelf WHERE iit.invoiceInFk = vSelf
AND iis.taxAreaFk = 'CEE' AND iis.taxAreaFk = 'CEE'
AND transactionTypeSageFk; AND iit.transactionTypeSageFk;
IF vHasDistinctTransactions > 1 THEN IF vDistinctTransactions > 1 THEN
CALL util.throw ('This invoice does not allow different types of transactions'); CALL util.throw ('This invoice does not allow different types of transactions');
END IF; END IF;
SELECT TRUE INTO vHasRepeatedTransactions
FROM invoiceInTax
WHERE invoiceInFk = vSelf
GROUP BY transactionTypeSageFk
HAVING COUNT(transactionTypeSageFk) > 1
LIMIT 1;
IF vHasRepeatedTransactions THEN
CALL util.throw ('This invoice contains repeated types of transactions');
END IF;
CREATE OR REPLACE TEMPORARY TABLE tInvoiceIn CREATE OR REPLACE TEMPORARY TABLE tInvoiceIn
ENGINE = MEMORY ENGINE = MEMORY
SELECT ii.bookEntried, SELECT ii.bookEntried,