add focusout constraint

This commit is contained in:
jpb 2021-07-21 08:56:40 +02:00
parent 7f6e4886fc
commit 62d007e232

View File

@ -679,11 +679,14 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
<?php if ($this->table_element_line != 'commande_fournisseurdet' || $this->table_element_line == 'facture_fourn_det') { ?> <?php if ($this->table_element_line != 'commande_fournisseurdet' || $this->table_element_line == 'facture_fourn_det') { ?>
$("#date_start, #date_end").focusout(function() $("#date_start, #date_end").focusout(function()
{ {
type = $(this).attr('type');
if (type == 1){
if ( $(this).val() == '' && !$(this).hasClass("error") ) { if ( $(this).val() == '' && !$(this).hasClass("error") ) {
$(this).addClass('error'); $(this).addClass('error');
}else{ }else{
$(this).removeClass('error'); $(this).removeClass('error');
} }
}
}); });
<?php } ?> <?php } ?>
/* When changing predefined product, we reload list of supplier prices required for margin combo */ /* When changing predefined product, we reload list of supplier prices required for margin combo */
@ -714,6 +717,11 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
function(data) { function(data) {
console.log("Load unit price end, we got value "+data.price_ht); console.log("Load unit price end, we got value "+data.price_ht);
$( '#date_start').removeAttr( "type" );
$( '#date_end' ).removeAttr( "type" );
$('#date_start').attr('type', data.type);
$('#date_end').attr('type', data.type);
// service and we setted mandatory_period to true // service and we setted mandatory_period to true
if (data.mandatory_period == 1 && data.type == 1 ) { if (data.mandatory_period == 1 && data.type == 1 ) {
jQuery("#date_start").addClass("error"); jQuery("#date_start").addClass("error");