Repaso de post en los metodos del controller (ValidarEntidad) para que no pete al meter solo el nombre de la entidad y sin salir del campo dar a guardar
git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@483 0c75b7a4-871f-7646-8a2f-f78d34cc349f
This commit is contained in:
parent
721f91b71c
commit
0d006f3f6e
@ -179,6 +179,9 @@ function TAlmacenesController.ValidarAlmacen(AAlmacen: IBizAlmacen): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if (AAlmacen.DataTable.State in dsEditModes) then
|
||||
AAlmacen.DataTable.Post;
|
||||
|
||||
if Length(AAlmacen.NOMBRE) = 0 then
|
||||
raise Exception.Create('Debe indicar al menos el nombre de este almacén.');
|
||||
|
||||
|
||||
@ -411,20 +411,25 @@ end;
|
||||
|
||||
function TArticulosController.ValidarArticulo(AArticulo: IBizArticulo): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if not Assigned(AArticulo) then
|
||||
raise Exception.Create ('Artículo no asignado');
|
||||
|
||||
if (AArticulo.DataTable.State in dsEditModes) then
|
||||
AArticulo.DataTable.Post;
|
||||
|
||||
//Tambien hacemos post de sus tablas hija
|
||||
if (AArticulo.Proveedores.DataTable.State in dsEditModes) then
|
||||
AArticulo.Proveedores.DataTable.Post;
|
||||
|
||||
if Length(AArticulo.DESCRIPCION) = 0 then
|
||||
raise Exception.Create('Debe indicar al menos la descripción de este artículo.');
|
||||
|
||||
// Asegurarse de valores en campos "automáticos"
|
||||
AArticulo.Edit;
|
||||
try
|
||||
AArticulo.USUARIO := AppFactuGES.UsuarioActivo.UserName;
|
||||
|
||||
AArticulo.USUARIO := AppFactuGES.UsuarioActivo.UserName;
|
||||
Result := True;
|
||||
finally
|
||||
AArticulo.Post;
|
||||
|
||||
@ -269,6 +269,8 @@ end;
|
||||
|
||||
function TContactosController.ValidarContacto(AContacto: IBizContacto): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if not Assigned(AContacto) then
|
||||
raise Exception.Create ('Contacto no asignado');
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ type
|
||||
procedure RecibirAviso(ASujeto: ISujeto; ADataTable: IDAStronglyTypedDataTable); override;
|
||||
function CreateEditor(const AName : String; const IID: TGUID; out Intf): Boolean;
|
||||
|
||||
function ValidarAlmacen(AFabricante: IBizFabricante): Boolean;
|
||||
function ValidarFabricante(AFabricante: IBizFabricante): Boolean;
|
||||
|
||||
//Estos son los tres métodos a sobre escribir si se desea heredar toda la logica de
|
||||
//este controller
|
||||
@ -129,9 +129,17 @@ begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TFabricantesController.ValidarAlmacen(AFabricante: IBizFabricante): Boolean;
|
||||
function TFabricantesController.ValidarFabricante(AFabricante: IBizFabricante): Boolean;
|
||||
begin
|
||||
//
|
||||
Result := False;
|
||||
|
||||
if not Assigned(AFabricante) then
|
||||
raise Exception.Create ('Fabricante no asignado');
|
||||
|
||||
if (AFabricante.DataTable.State in dsEditModes) then
|
||||
AFabricante.DataTable.Post;
|
||||
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
procedure TFabricantesController.ValidarObjetos;
|
||||
@ -197,13 +205,10 @@ begin
|
||||
|
||||
ValidarObjetos;
|
||||
|
||||
if ValidarAlmacen(AFabricante) then
|
||||
if ValidarFabricante(AFabricante) then
|
||||
begin
|
||||
ShowHourglassCursor;
|
||||
try
|
||||
if (AFabricante.DataTable.State in dsEditModes) then
|
||||
AFabricante.DataTable.Post;
|
||||
|
||||
AFabricante.DataTable.ApplyUpdates;
|
||||
|
||||
Result := True;
|
||||
|
||||
@ -518,6 +518,8 @@ end;
|
||||
|
||||
function TFacturasClienteController.ValidarFactura(AFactura: IBizFacturaCliente): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if not Assigned(AFactura) then
|
||||
raise Exception.Create ('Factura no asignada');
|
||||
|
||||
|
||||
@ -376,6 +376,8 @@ end;
|
||||
|
||||
function TFacturasProveedorController.ValidarFactura(AFactura: IBizFacturaProveedor): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if not Assigned(AFactura) then
|
||||
raise Exception.Create ('Factura no asignada');
|
||||
|
||||
|
||||
@ -129,6 +129,14 @@ end;
|
||||
|
||||
function TFamiliasController.ValidarFamilia(AFamilia: IBizFamilia): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if not Assigned(AFamilia) then
|
||||
raise Exception.Create ('Familia no asignada');
|
||||
|
||||
if (AFamilia.DataTable.State in dsEditModes) then
|
||||
AFamilia.DataTable.Post;
|
||||
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
@ -190,9 +198,6 @@ begin
|
||||
begin
|
||||
ShowHourglassCursor;
|
||||
try
|
||||
if (AFamilia.DataTable.State in dsEditModes) then
|
||||
AFamilia.DataTable.Post;
|
||||
|
||||
AFamilia.DataTable.ApplyUpdates;
|
||||
|
||||
Result := True;
|
||||
|
||||
@ -156,6 +156,8 @@ end;
|
||||
|
||||
function TFormasPagoController.ValidarFormaPago(AFormaPago: IBizFormaPago): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if not Assigned(AFormaPago) then
|
||||
raise Exception.Create ('Forma de pago no asignada');
|
||||
|
||||
|
||||
@ -221,6 +221,14 @@ end;
|
||||
|
||||
function TObrasController.ValidarObra(AObra: IBizObra): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if not Assigned(AObra) then
|
||||
raise Exception.Create ('Obra no asignada');
|
||||
|
||||
if (AObra.DataTable.State in dsEditModes) then
|
||||
AObra.DataTable.Post;
|
||||
|
||||
if Length(AObra.NOMBRE) = 0 then
|
||||
raise Exception.Create('Debe indicar al menos el nombre de esta obra.');
|
||||
|
||||
@ -407,9 +415,6 @@ begin
|
||||
begin
|
||||
ShowHourglassCursor;
|
||||
try
|
||||
if (AObra.DataTable.State in dsEditModes) then
|
||||
AObra.DataTable.Post;
|
||||
|
||||
// AsignarCodigo(AObra);
|
||||
AObra.DataTable.ApplyUpdates;
|
||||
|
||||
|
||||
@ -462,6 +462,8 @@ end;
|
||||
|
||||
function TRecibosProveedorController.ValidarReciboProveedor(ARecibosProveedor: IBizRecibosProveedor): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if not Assigned(ARecibosProveedor) then
|
||||
raise Exception.Create ('IBizRecibosProveedor no asignado');
|
||||
|
||||
|
||||
@ -188,6 +188,8 @@ end;
|
||||
|
||||
function TRemesasClienteController.ValidarRemesaCliente(ARemesaCliente: IBizRemesaCliente): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if not Assigned(ARemesaCliente) then
|
||||
raise Exception.Create ('Remesa no asignada');
|
||||
|
||||
|
||||
@ -188,6 +188,8 @@ end;
|
||||
|
||||
function TRemesasProveedorController.ValidarRemesaProveedor(ARemesaProveedor: IBizRemesaProveedor): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if not Assigned(ARemesaProveedor) then
|
||||
raise Exception.Create ('Remesa no asignada');
|
||||
|
||||
|
||||
@ -190,6 +190,8 @@ end;
|
||||
|
||||
function TTiposIVAController.ValidarTipoIVA(ATipoIVA: IBizTipoIVA): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if not Assigned(ATipoIVA) then
|
||||
raise Exception.Create ('TipoIVA no asignado');
|
||||
|
||||
|
||||
@ -126,9 +126,16 @@ begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TUnidadesMedidaController.ValidarUnidadesMedida(
|
||||
AUnidadMedida: IBizUnidadMedida): Boolean;
|
||||
function TUnidadesMedidaController.ValidarUnidadesMedida(AUnidadMedida: IBizUnidadMedida): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if not Assigned(AUnidadesMedida) then
|
||||
raise Exception.Create ('UnidadMedida no asignada');
|
||||
|
||||
if (AUnidadMedida.DataTable.State in dsEditModes) then
|
||||
AUnidadMedida.DataTable.Post;
|
||||
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
@ -190,11 +197,7 @@ begin
|
||||
begin
|
||||
ShowHourglassCursor;
|
||||
try
|
||||
if (AUnidadMedida.DataTable.State in dsEditModes) then
|
||||
AUnidadMedida.DataTable.Post;
|
||||
|
||||
AUnidadMedida.DataTable.ApplyUpdates;
|
||||
|
||||
Result := True;
|
||||
finally
|
||||
HideHourglassCursor;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user