2014-12-01 23:55:08 +01:00
|
|
|
|
// swad_place.c: places
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
SWAD (Shared Workspace At a Distance),
|
|
|
|
|
is a web platform developed at the University of Granada (Spain),
|
|
|
|
|
and used to support university teaching.
|
|
|
|
|
|
|
|
|
|
This file is part of SWAD core.
|
2020-01-01 14:53:57 +01:00
|
|
|
|
Copyright (C) 1999-2020 Antonio Ca<EFBFBD>as Vargas
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU Affero General Public License as
|
|
|
|
|
published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************************** Headers **********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-29 12:39:00 +01:00
|
|
|
|
#include <stddef.h> // For NULL
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include <stdlib.h> // For calloc
|
|
|
|
|
#include <string.h> // For string functions
|
|
|
|
|
|
2017-06-10 21:38:10 +02:00
|
|
|
|
#include "swad_box.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_constant.h"
|
|
|
|
|
#include "swad_database.h"
|
2018-11-09 20:47:39 +01:00
|
|
|
|
#include "swad_form.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_global.h"
|
2019-10-23 19:05:05 +02:00
|
|
|
|
#include "swad_HTML.h"
|
2018-12-08 16:43:13 +01:00
|
|
|
|
#include "swad_language.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_parameter.h"
|
|
|
|
|
#include "swad_place.h"
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** External global variables from others modules ****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
extern struct Globals Gbl;
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Private constants *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************************* Private types *******************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Private variables *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-13 21:26:47 +02:00
|
|
|
|
static struct Plc_Place *Plc_EditingPlc = NULL; // Static variable to keep the place being edited
|
2019-04-09 00:24:50 +02:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Private prototypes ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-13 21:26:47 +02:00
|
|
|
|
static Plc_Order_t Plc_GetParamPlcOrder (void);
|
2018-11-15 10:33:45 +01:00
|
|
|
|
static bool Plc_CheckIfICanCreatePlaces (void);
|
2020-04-08 22:09:35 +02:00
|
|
|
|
static void Plc_PutIconsListingPlaces (__attribute__((unused)) void *Args);
|
2016-03-16 22:40:35 +01:00
|
|
|
|
static void Plc_PutIconToEditPlaces (void);
|
2019-04-09 00:24:50 +02:00
|
|
|
|
static void Plc_EditPlacesInternal (void);
|
2020-04-08 22:09:35 +02:00
|
|
|
|
static void Plc_PutIconsEditingPlaces (__attribute__((unused)) void *Args);
|
2018-11-15 10:13:53 +01:00
|
|
|
|
|
2020-04-13 21:26:47 +02:00
|
|
|
|
static void Plc_ListPlacesForEdition (const struct Plc_Places *Places);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
static void Plc_PutParamPlcCod (long PlcCod);
|
2017-03-09 11:16:17 +01:00
|
|
|
|
|
2016-10-28 10:03:37 +02:00
|
|
|
|
static void Plc_RenamePlace (Cns_ShrtOrFullName_t ShrtOrFullName);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
static bool Plc_CheckIfPlaceNameExists (const char *FieldName,const char *Name,long PlcCod);
|
2017-03-09 11:16:17 +01:00
|
|
|
|
static void Plc_UpdatePlcNameDB (long PlcCod,const char *FieldName,const char *NewPlcName);
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
static void Plc_PutFormToCreatePlace (void);
|
|
|
|
|
static void Plc_PutHeadPlaces (void);
|
2020-04-13 21:26:47 +02:00
|
|
|
|
static void Plc_CreatePlace (struct Plc_Place *Plc);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-04-09 00:24:50 +02:00
|
|
|
|
static void Plc_EditingPlaceConstructor (void);
|
|
|
|
|
static void Plc_EditingPlaceDestructor (void);
|
|
|
|
|
|
2020-04-13 21:26:47 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**************************** Reset places context ***************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Plc_ResetPlaces (struct Plc_Places *Places)
|
|
|
|
|
{
|
2020-04-13 22:04:46 +02:00
|
|
|
|
Places->Num = 0;
|
|
|
|
|
Places->Lst = NULL;
|
2020-04-13 21:26:47 +02:00
|
|
|
|
Places->SelectedOrder = Plc_ORDER_DEFAULT;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************************** List all the places *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Plc_SeePlaces (void)
|
|
|
|
|
{
|
2016-11-28 12:11:44 +01:00
|
|
|
|
extern const char *Hlp_INSTITUTION_Places;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
extern const char *Txt_Places;
|
|
|
|
|
extern const char *Txt_PLACES_HELP_ORDER[2];
|
|
|
|
|
extern const char *Txt_PLACES_ORDER[2];
|
|
|
|
|
extern const char *Txt_Other_places;
|
|
|
|
|
extern const char *Txt_Place_unspecified;
|
2017-03-27 13:38:10 +02:00
|
|
|
|
extern const char *Txt_New_place;
|
2020-04-13 21:26:47 +02:00
|
|
|
|
struct Plc_Places Places;
|
2017-01-29 12:42:19 +01:00
|
|
|
|
Plc_Order_t Order;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
unsigned NumPlc;
|
|
|
|
|
unsigned NumCtrsWithPlc = 0;
|
|
|
|
|
unsigned NumCtrsInOtherPlcs;
|
|
|
|
|
|
2019-04-03 20:57:04 +02:00
|
|
|
|
if (Gbl.Hierarchy.Ins.InsCod > 0)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2020-04-13 21:26:47 +02:00
|
|
|
|
/***** Reset places context *****/
|
|
|
|
|
Plc_ResetPlaces (&Places);
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/***** Get parameter with the type of order in the list of places *****/
|
2020-04-13 21:26:47 +02:00
|
|
|
|
Places.SelectedOrder = Plc_GetParamPlcOrder ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Get list of places *****/
|
2020-04-13 21:26:47 +02:00
|
|
|
|
Plc_GetListPlaces (&Places);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Table head *****/
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Box_BoxBegin (NULL,Txt_Places,
|
2020-04-08 22:09:35 +02:00
|
|
|
|
Plc_PutIconsListingPlaces,NULL,
|
2017-06-12 15:03:29 +02:00
|
|
|
|
Hlp_INSTITUTION_Places,Box_NOT_CLOSABLE);
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TABLE_BeginWideMarginPadding (2);
|
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-12-15 20:02:34 +01:00
|
|
|
|
for (Order = (Plc_Order_t) 0;
|
|
|
|
|
Order <= (Plc_Order_t) (Plc_NUM_ORDERS - 1);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Order++)
|
|
|
|
|
{
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TH_Begin (1,1,"LM");
|
2019-10-13 16:21:05 +02:00
|
|
|
|
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartForm (ActSeePlc);
|
2019-11-03 13:19:32 +01:00
|
|
|
|
Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) Order);
|
2019-11-20 10:17:42 +01:00
|
|
|
|
HTM_BUTTON_SUBMIT_Begin (Txt_PLACES_HELP_ORDER[Order],"BT_LINK TIT_TBL",NULL);
|
2020-04-13 21:26:47 +02:00
|
|
|
|
if (Order == Places.SelectedOrder)
|
2019-11-10 16:41:47 +01:00
|
|
|
|
HTM_U_Begin ();
|
2019-11-10 12:36:37 +01:00
|
|
|
|
HTM_Txt (Txt_PLACES_ORDER[Order]);
|
2020-04-13 21:26:47 +02:00
|
|
|
|
if (Order == Places.SelectedOrder)
|
2019-11-10 16:41:47 +01:00
|
|
|
|
HTM_U_End ();
|
2019-11-18 20:12:10 +01:00
|
|
|
|
HTM_BUTTON_End ();
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_EndForm ();
|
2019-10-13 16:21:05 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TH_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2015-11-15 23:07:19 +01:00
|
|
|
|
/***** Write all places and their nuber of centres *****/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
for (NumPlc = 0;
|
2020-04-13 21:26:47 +02:00
|
|
|
|
NumPlc < Places.Num;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
NumPlc++)
|
|
|
|
|
{
|
|
|
|
|
/* Write data of this place */
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"DAT LM\"");
|
2020-04-13 21:26:47 +02:00
|
|
|
|
HTM_Txt (Places.Lst[NumPlc].FullName);
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_End ();
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"DAT RM\"");
|
2020-04-13 21:26:47 +02:00
|
|
|
|
HTM_Unsigned (Places.Lst[NumPlc].NumCtrs);
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_End ();
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2020-04-13 21:26:47 +02:00
|
|
|
|
NumCtrsWithPlc += Places.Lst[NumPlc].NumCtrs;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Separation row *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
HTM_TD_Begin ("colspan=\"2\" class=\"DAT\"");
|
2019-11-14 08:59:11 +01:00
|
|
|
|
HTM_NBSP ();
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
HTM_TR_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2015-11-15 23:07:19 +01:00
|
|
|
|
/***** Write centres (of the current institution) with other place *****/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
NumCtrsInOtherPlcs = Ctr_GetNumCtrsInPlc (0);
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"DAT LM\"");
|
2019-11-10 12:36:37 +01:00
|
|
|
|
HTM_Txt (Txt_Other_places);
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_End ();
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"DAT RM\"");
|
2019-11-10 13:31:47 +01:00
|
|
|
|
HTM_Unsigned (NumCtrsInOtherPlcs);
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_End ();
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
NumCtrsWithPlc += NumCtrsInOtherPlcs;
|
|
|
|
|
|
2015-11-15 23:07:19 +01:00
|
|
|
|
/***** Write centres (of the current institution) with no place *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"DAT LM\"");
|
2019-11-10 12:36:37 +01:00
|
|
|
|
HTM_Txt (Txt_Place_unspecified);
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_End ();
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"DAT RM\"");
|
2019-11-10 13:31:47 +01:00
|
|
|
|
HTM_Unsigned (Ctr_GetNumCtrsInIns (Gbl.Hierarchy.Ins.InsCod) -
|
2020-05-03 20:58:03 +02:00
|
|
|
|
NumCtrsWithPlc);
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_End ();
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-05-01 12:36:24 +02:00
|
|
|
|
/***** End table *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TABLE_End ();
|
2017-03-01 17:36:49 +01:00
|
|
|
|
|
|
|
|
|
/***** Button to create place *****/
|
2018-11-15 10:33:45 +01:00
|
|
|
|
if (Plc_CheckIfICanCreatePlaces ())
|
2017-03-01 17:36:49 +01:00
|
|
|
|
{
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartForm (ActEdiPlc);
|
2017-06-11 19:02:40 +02:00
|
|
|
|
Btn_PutConfirmButton (Txt_New_place);
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_EndForm ();
|
2017-03-01 17:36:49 +01:00
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 14:16:33 +02:00
|
|
|
|
/***** End box *****/
|
2019-10-25 22:48:34 +02:00
|
|
|
|
Box_BoxEnd ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Free list of places *****/
|
2020-04-13 21:26:47 +02:00
|
|
|
|
Plc_FreeListPlaces (&Places);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********** Get parameter with the type or order in list of places ***********/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-13 21:26:47 +02:00
|
|
|
|
static Plc_Order_t Plc_GetParamPlcOrder (void)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2020-04-13 21:26:47 +02:00
|
|
|
|
return (Plc_Order_t) Par_GetParToUnsignedLong ("Order",
|
|
|
|
|
0,
|
|
|
|
|
Plc_NUM_ORDERS - 1,
|
|
|
|
|
(unsigned long) Plc_ORDER_DEFAULT);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2018-11-15 10:13:53 +01:00
|
|
|
|
/*****************************************************************************/
|
2018-11-15 10:33:45 +01:00
|
|
|
|
/********************** Check if I can create places *************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static bool Plc_CheckIfICanCreatePlaces (void)
|
|
|
|
|
{
|
|
|
|
|
return (bool) (Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************** Put contextual icons in list of places *******************/
|
2018-11-15 10:13:53 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-08 22:09:35 +02:00
|
|
|
|
static void Plc_PutIconsListingPlaces (__attribute__((unused)) void *Args)
|
2018-11-15 10:13:53 +01:00
|
|
|
|
{
|
2020-04-08 22:09:35 +02:00
|
|
|
|
/***** Put icon to edit places *****/
|
|
|
|
|
if (Plc_CheckIfICanCreatePlaces ())
|
|
|
|
|
Plc_PutIconToEditPlaces ();
|
2018-11-15 10:13:53 +01:00
|
|
|
|
|
2020-04-08 22:09:35 +02:00
|
|
|
|
/***** Put icon to view centres *****/
|
|
|
|
|
Ctr_PutIconToViewCentres ();
|
2018-11-15 10:13:53 +01:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************** Put a link (form) to edit places *********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-03-16 22:40:35 +01:00
|
|
|
|
static void Plc_PutIconToEditPlaces (void)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Ico_PutContextualIconToEdit (ActEdiPlc,NULL,
|
|
|
|
|
NULL,NULL);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************************** Put forms to edit places ************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Plc_EditPlaces (void)
|
2019-04-09 00:24:50 +02:00
|
|
|
|
{
|
|
|
|
|
/***** Place constructor *****/
|
|
|
|
|
Plc_EditingPlaceConstructor ();
|
|
|
|
|
|
|
|
|
|
/***** Edit places *****/
|
|
|
|
|
Plc_EditPlacesInternal ();
|
|
|
|
|
|
|
|
|
|
/***** Place destructor *****/
|
|
|
|
|
Plc_EditingPlaceDestructor ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void Plc_EditPlacesInternal (void)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2017-04-30 21:00:56 +02:00
|
|
|
|
extern const char *Hlp_INSTITUTION_Places_edit;
|
|
|
|
|
extern const char *Txt_Places;
|
2020-04-13 21:26:47 +02:00
|
|
|
|
struct Plc_Places Places;
|
|
|
|
|
|
|
|
|
|
/***** Reset places context *****/
|
|
|
|
|
Plc_ResetPlaces (&Places);
|
2017-04-30 21:00:56 +02:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/***** Get list of places *****/
|
2020-04-13 21:26:47 +02:00
|
|
|
|
Plc_GetListPlaces (&Places);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-10-26 02:19:42 +02:00
|
|
|
|
/***** Begin box *****/
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Box_BoxBegin (NULL,Txt_Places,
|
2020-04-08 22:09:35 +02:00
|
|
|
|
Plc_PutIconsEditingPlaces,NULL,
|
2017-06-12 15:03:29 +02:00
|
|
|
|
Hlp_INSTITUTION_Places_edit,Box_NOT_CLOSABLE);
|
2017-04-30 21:00:56 +02:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/***** Put a form to create a new place *****/
|
|
|
|
|
Plc_PutFormToCreatePlace ();
|
|
|
|
|
|
|
|
|
|
/***** Forms to edit current places *****/
|
2020-04-13 21:26:47 +02:00
|
|
|
|
if (Places.Num)
|
|
|
|
|
Plc_ListPlacesForEdition (&Places);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-06-12 14:16:33 +02:00
|
|
|
|
/***** End box *****/
|
2019-10-25 22:48:34 +02:00
|
|
|
|
Box_BoxEnd ();
|
2017-04-30 21:00:56 +02:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/***** Free list of places *****/
|
2020-04-13 21:26:47 +02:00
|
|
|
|
Plc_FreeListPlaces (&Places);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2017-04-30 21:00:56 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**************** Put contextual icons in edition of places *****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-08 22:09:35 +02:00
|
|
|
|
static void Plc_PutIconsEditingPlaces (__attribute__((unused)) void *Args)
|
2017-04-30 21:00:56 +02:00
|
|
|
|
{
|
2020-04-08 22:09:35 +02:00
|
|
|
|
/***** Put icon to view places *****/
|
|
|
|
|
Plc_PutIconToViewPlaces ();
|
2018-11-15 10:41:11 +01:00
|
|
|
|
|
2020-04-08 22:09:35 +02:00
|
|
|
|
/***** Put icon to view centres *****/
|
|
|
|
|
Ctr_PutIconToViewCentres ();
|
2018-11-15 10:41:11 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************** Put icon to view places **************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Plc_PutIconToViewPlaces (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Places;
|
|
|
|
|
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActSeePlc,NULL,
|
2020-04-08 18:18:46 +02:00
|
|
|
|
Ins_PutParamCurrentInsCod,&Gbl.Hierarchy.Ins.InsCod,
|
2019-01-12 03:00:59 +01:00
|
|
|
|
"map-marker-alt.svg",
|
|
|
|
|
Txt_Places);
|
2017-04-30 21:00:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**************************** List all the places ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-13 21:26:47 +02:00
|
|
|
|
void Plc_GetListPlaces (struct Plc_Places *Places)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2019-01-03 15:25:18 +01:00
|
|
|
|
static const char *OrderBySubQuery[Plc_NUM_ORDERS] =
|
|
|
|
|
{
|
2019-11-21 01:27:17 +01:00
|
|
|
|
[Plc_ORDER_BY_PLACE ] = "FullName",
|
|
|
|
|
[Plc_ORDER_BY_NUM_CTRS] = "NumCtrs DESC,FullName",
|
2019-01-03 15:25:18 +01:00
|
|
|
|
};
|
2014-12-01 23:55:08 +01:00
|
|
|
|
MYSQL_RES *mysql_res;
|
|
|
|
|
MYSQL_ROW row;
|
|
|
|
|
unsigned long NumRows;
|
|
|
|
|
unsigned NumPlc;
|
2020-04-13 21:26:47 +02:00
|
|
|
|
struct Plc_Place *Plc;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Get places from database *****/
|
2018-11-01 19:23:52 +01:00
|
|
|
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get places",
|
|
|
|
|
"(SELECT places.PlcCod,"
|
|
|
|
|
"places.ShortName,"
|
|
|
|
|
"places.FullName,"
|
|
|
|
|
"COUNT(*) AS NumCtrs"
|
|
|
|
|
" FROM places,centres"
|
|
|
|
|
" WHERE places.InsCod=%ld"
|
|
|
|
|
" AND places.PlcCod=centres.PlcCod"
|
|
|
|
|
" AND centres.InsCod=%ld"
|
|
|
|
|
" GROUP BY places.PlcCod)"
|
|
|
|
|
" UNION "
|
|
|
|
|
"(SELECT PlcCod,"
|
|
|
|
|
"ShortName,"
|
|
|
|
|
"FullName,"
|
|
|
|
|
"0 AS NumCtrs"
|
|
|
|
|
" FROM places"
|
|
|
|
|
" WHERE InsCod=%ld"
|
|
|
|
|
" AND PlcCod NOT IN"
|
|
|
|
|
" (SELECT DISTINCT PlcCod FROM centres"
|
|
|
|
|
" WHERE InsCod=%ld))"
|
|
|
|
|
" ORDER BY %s",
|
2019-04-03 20:57:04 +02:00
|
|
|
|
Gbl.Hierarchy.Ins.InsCod,
|
|
|
|
|
Gbl.Hierarchy.Ins.InsCod,
|
|
|
|
|
Gbl.Hierarchy.Ins.InsCod,
|
|
|
|
|
Gbl.Hierarchy.Ins.InsCod,
|
2020-04-13 21:26:47 +02:00
|
|
|
|
OrderBySubQuery[Places->SelectedOrder]);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Count number of rows in result *****/
|
|
|
|
|
if (NumRows) // Places found...
|
|
|
|
|
{
|
2020-04-13 21:26:47 +02:00
|
|
|
|
Places->Num = (unsigned) NumRows;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Create list with courses in centre *****/
|
2020-04-13 21:26:47 +02:00
|
|
|
|
if ((Places->Lst = (struct Plc_Place *) calloc (NumRows,sizeof (struct Plc_Place))) == NULL)
|
2018-10-18 20:06:54 +02:00
|
|
|
|
Lay_NotEnoughMemoryExit ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Get the places *****/
|
|
|
|
|
for (NumPlc = 0;
|
2020-04-13 21:26:47 +02:00
|
|
|
|
NumPlc < Places->Num;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
NumPlc++)
|
|
|
|
|
{
|
2020-04-13 21:26:47 +02:00
|
|
|
|
Plc = &(Places->Lst[NumPlc]);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Get next place */
|
|
|
|
|
row = mysql_fetch_row (mysql_res);
|
|
|
|
|
|
|
|
|
|
/* Get place code (row[0]) */
|
|
|
|
|
if ((Plc->PlcCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
|
|
|
|
Lay_ShowErrorAndExit ("Wrong code of place.");
|
|
|
|
|
|
|
|
|
|
/* Get the short name of the place (row[1]) */
|
2017-01-17 03:10:43 +01:00
|
|
|
|
Str_Copy (Plc->ShrtName,row[1],
|
2017-03-07 19:55:29 +01:00
|
|
|
|
Plc_MAX_BYTES_PLACE_SHRT_NAME);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Get the full name of the place (row[2]) */
|
2017-01-17 03:10:43 +01:00
|
|
|
|
Str_Copy (Plc->FullName,row[2],
|
2017-03-07 19:55:29 +01:00
|
|
|
|
Plc_MAX_BYTES_PLACE_FULL_NAME);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Get number of centres in this place (row[3]) */
|
|
|
|
|
if (sscanf (row[3],"%u",&Plc->NumCtrs) != 1)
|
|
|
|
|
Plc->NumCtrs = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
2020-04-13 21:26:47 +02:00
|
|
|
|
Places->Num = 0;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Free structure that stores the query result *****/
|
|
|
|
|
DB_FreeMySQLResult (&mysql_res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**************************** Get place full name ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-13 21:26:47 +02:00
|
|
|
|
void Plc_GetDataOfPlaceByCod (struct Plc_Place *Plc)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2015-12-09 22:05:21 +01:00
|
|
|
|
extern const char *Txt_Place_unspecified;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
extern const char *Txt_Another_place;
|
|
|
|
|
MYSQL_RES *mysql_res;
|
|
|
|
|
MYSQL_ROW row;
|
|
|
|
|
unsigned long NumRows;
|
|
|
|
|
|
|
|
|
|
/***** Clear data *****/
|
2016-10-28 10:03:37 +02:00
|
|
|
|
Plc->ShrtName[0] = '\0';
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Plc->FullName[0] = '\0';
|
|
|
|
|
Plc->NumCtrs = 0;
|
|
|
|
|
|
|
|
|
|
/***** Check if place code is correct *****/
|
2015-12-09 22:05:21 +01:00
|
|
|
|
if (Plc->PlcCod < 0)
|
|
|
|
|
{
|
2017-01-15 18:02:52 +01:00
|
|
|
|
Str_Copy (Plc->ShrtName,Txt_Place_unspecified,
|
2017-03-07 19:55:29 +01:00
|
|
|
|
Plc_MAX_BYTES_PLACE_SHRT_NAME);
|
2017-01-15 18:02:52 +01:00
|
|
|
|
Str_Copy (Plc->FullName,Txt_Place_unspecified,
|
2017-03-07 19:55:29 +01:00
|
|
|
|
Plc_MAX_BYTES_PLACE_FULL_NAME);
|
2015-12-09 22:05:21 +01:00
|
|
|
|
}
|
|
|
|
|
else if (Plc->PlcCod == 0)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2017-01-17 03:10:43 +01:00
|
|
|
|
Str_Copy (Plc->ShrtName,Txt_Another_place,
|
2017-03-07 19:55:29 +01:00
|
|
|
|
Plc_MAX_BYTES_PLACE_SHRT_NAME);
|
2017-01-17 03:10:43 +01:00
|
|
|
|
Str_Copy (Plc->FullName,Txt_Another_place,
|
2017-03-07 19:55:29 +01:00
|
|
|
|
Plc_MAX_BYTES_PLACE_FULL_NAME);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
else if (Plc->PlcCod > 0)
|
|
|
|
|
{
|
|
|
|
|
/***** Get data of a place from database *****/
|
2018-11-01 19:23:52 +01:00
|
|
|
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get data of a place",
|
|
|
|
|
"(SELECT places.ShortName,"
|
|
|
|
|
"places.FullName,"
|
|
|
|
|
"COUNT(*)"
|
|
|
|
|
" FROM places,centres"
|
|
|
|
|
" WHERE places.PlcCod=%ld"
|
|
|
|
|
" AND places.PlcCod=centres.PlcCod"
|
|
|
|
|
" AND centres.PlcCod=%ld"
|
|
|
|
|
" GROUP BY places.PlcCod)"
|
|
|
|
|
" UNION "
|
|
|
|
|
"(SELECT ShortName,"
|
|
|
|
|
"FullName,"
|
|
|
|
|
"0"
|
|
|
|
|
" FROM places"
|
|
|
|
|
" WHERE PlcCod=%ld"
|
|
|
|
|
" AND PlcCod NOT IN"
|
|
|
|
|
" (SELECT DISTINCT PlcCod FROM centres))",
|
|
|
|
|
Plc->PlcCod,
|
|
|
|
|
Plc->PlcCod,
|
|
|
|
|
Plc->PlcCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Count number of rows in result *****/
|
|
|
|
|
if (NumRows) // Place found...
|
|
|
|
|
{
|
|
|
|
|
/* Get row */
|
|
|
|
|
row = mysql_fetch_row (mysql_res);
|
|
|
|
|
|
|
|
|
|
/* Get the short name of the place (row[0]) */
|
2017-01-17 03:10:43 +01:00
|
|
|
|
Str_Copy (Plc->ShrtName,row[0],
|
2017-03-07 19:55:29 +01:00
|
|
|
|
Plc_MAX_BYTES_PLACE_SHRT_NAME);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Get the full name of the place (row[1]) */
|
2017-01-17 03:10:43 +01:00
|
|
|
|
Str_Copy (Plc->FullName,row[1],
|
2017-03-07 19:55:29 +01:00
|
|
|
|
Plc_MAX_BYTES_PLACE_FULL_NAME);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Get number of centres in this place (row[2]) */
|
|
|
|
|
if (sscanf (row[2],"%u",&Plc->NumCtrs) != 1)
|
|
|
|
|
Plc->NumCtrs = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Free structure that stores the query result *****/
|
|
|
|
|
DB_FreeMySQLResult (&mysql_res);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**************************** Free list of places ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-13 21:26:47 +02:00
|
|
|
|
void Plc_FreeListPlaces (struct Plc_Places *Places)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2020-04-13 21:26:47 +02:00
|
|
|
|
if (Places->Lst)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Free memory used by the list of places in institution *****/
|
2020-04-13 21:26:47 +02:00
|
|
|
|
free (Places->Lst);
|
|
|
|
|
Places->Lst = NULL;
|
|
|
|
|
Places->Num = 0;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************************** List all the places *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-13 21:26:47 +02:00
|
|
|
|
static void Plc_ListPlacesForEdition (const struct Plc_Places *Places)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
unsigned NumPlc;
|
2020-04-13 21:26:47 +02:00
|
|
|
|
struct Plc_Place *Plc;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-04-30 21:00:56 +02:00
|
|
|
|
/***** Write heading *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TABLE_BeginWidePadding (2);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Plc_PutHeadPlaces ();
|
|
|
|
|
|
|
|
|
|
/***** Write all the places *****/
|
|
|
|
|
for (NumPlc = 0;
|
2020-04-13 21:26:47 +02:00
|
|
|
|
NumPlc < Places->Num;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
NumPlc++)
|
|
|
|
|
{
|
2020-04-13 21:26:47 +02:00
|
|
|
|
Plc = &Places->Lst[NumPlc];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-09 21:05:58 +02:00
|
|
|
|
|
|
|
|
|
/* Put icon to remove place */
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"BM\"");
|
2014-12-01 23:55:08 +01:00
|
|
|
|
if (Plc->NumCtrs) // Place has centres ==> deletion forbidden
|
2017-06-11 19:13:28 +02:00
|
|
|
|
Ico_PutIconRemovalNotAllowed ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartForm (ActRemPlc);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Plc_PutParamPlcCod (Plc->PlcCod);
|
2017-06-11 19:13:28 +02:00
|
|
|
|
Ico_PutIconRemove ();
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_EndForm ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Place code */
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"DAT RM\"");
|
2019-11-10 13:38:17 +01:00
|
|
|
|
HTM_Long (Plc->PlcCod);
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Place short name */
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"CM\"");
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartForm (ActRenPlcSho);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Plc_PutParamPlcCod (Plc->PlcCod);
|
2020-04-27 03:16:55 +02:00
|
|
|
|
HTM_INPUT_TEXT ("ShortName",Plc_MAX_CHARS_PLACE_SHRT_NAME,Plc->ShrtName,
|
|
|
|
|
HTM_SUBMIT_ON_CHANGE,
|
2019-11-04 12:25:48 +01:00
|
|
|
|
"class=\"INPUT_SHORT_NAME\"");
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_EndForm ();
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Place full name */
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"CM\"");
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartForm (ActRenPlcFul);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Plc_PutParamPlcCod (Plc->PlcCod);
|
2020-04-27 03:16:55 +02:00
|
|
|
|
HTM_INPUT_TEXT ("FullName",Plc_MAX_CHARS_PLACE_FULL_NAME,Plc->FullName,
|
|
|
|
|
HTM_SUBMIT_ON_CHANGE,
|
2019-11-04 12:25:48 +01:00
|
|
|
|
"class=\"INPUT_FULL_NAME\"");
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_EndForm ();
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Number of centres */
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"DAT RM\"");
|
2019-11-10 13:31:47 +01:00
|
|
|
|
HTM_Unsigned (Plc->NumCtrs);
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_End ();
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2017-05-01 10:22:16 +02:00
|
|
|
|
/***** End table *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TABLE_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************** Write parameter with code of place *********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Plc_PutParamPlcCod (long PlcCod)
|
|
|
|
|
{
|
2019-11-03 13:19:32 +01:00
|
|
|
|
Par_PutHiddenParamLong (NULL,"PlcCod",PlcCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************* Get parameter with code of place **********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
long Plc_GetParamPlcCod (void)
|
|
|
|
|
{
|
2017-01-28 20:32:50 +01:00
|
|
|
|
/***** Get code of place *****/
|
|
|
|
|
return Par_GetParToLong ("PlcCod");
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************************* Remove a place ******************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Plc_RemovePlace (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_To_remove_a_place_you_must_first_remove_all_centres_of_that_place;
|
|
|
|
|
extern const char *Txt_Place_X_removed;
|
2019-04-09 00:24:50 +02:00
|
|
|
|
|
|
|
|
|
/***** Place constructor *****/
|
|
|
|
|
Plc_EditingPlaceConstructor ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Get place code *****/
|
2019-04-09 00:24:50 +02:00
|
|
|
|
if ((Plc_EditingPlc->PlcCod = Plc_GetParamPlcCod ()) == -1L)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Lay_ShowErrorAndExit ("Code of place is missing.");
|
|
|
|
|
|
|
|
|
|
/***** Get data of the place from database *****/
|
2019-04-09 00:24:50 +02:00
|
|
|
|
Plc_GetDataOfPlaceByCod (Plc_EditingPlc);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Check if this place has centres *****/
|
2019-04-09 00:24:50 +02:00
|
|
|
|
if (Plc_EditingPlc->NumCtrs) // Place has centres ==> don't remove
|
|
|
|
|
Ale_CreateAlert (Ale_WARNING,NULL,
|
|
|
|
|
Txt_To_remove_a_place_you_must_first_remove_all_centres_of_that_place);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
else // Place has no centres ==> remove it
|
|
|
|
|
{
|
|
|
|
|
/***** Remove place *****/
|
2018-11-02 22:00:31 +01:00
|
|
|
|
DB_QueryDELETE ("can not remove a place",
|
|
|
|
|
"DELETE FROM places WHERE PlcCod=%ld",
|
2019-04-09 00:24:50 +02:00
|
|
|
|
Plc_EditingPlc->PlcCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Write message to show the change made *****/
|
2019-04-09 00:24:50 +02:00
|
|
|
|
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
|
|
|
|
Txt_Place_X_removed,
|
|
|
|
|
Plc_EditingPlc->FullName);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************* Change the short name of a place **********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Plc_RenamePlaceShort (void)
|
|
|
|
|
{
|
2019-04-09 00:24:50 +02:00
|
|
|
|
/***** Place constructor *****/
|
|
|
|
|
Plc_EditingPlaceConstructor ();
|
|
|
|
|
|
|
|
|
|
/***** Rename place *****/
|
2016-10-28 10:03:37 +02:00
|
|
|
|
Plc_RenamePlace (Cns_SHRT_NAME);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************* Change the full name of a place ***********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Plc_RenamePlaceFull (void)
|
|
|
|
|
{
|
2019-04-09 00:24:50 +02:00
|
|
|
|
/***** Place constructor *****/
|
|
|
|
|
Plc_EditingPlaceConstructor ();
|
|
|
|
|
|
|
|
|
|
/***** Rename place *****/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Plc_RenamePlace (Cns_FULL_NAME);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************ Change the name of a place *************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-10-28 10:03:37 +02:00
|
|
|
|
static void Plc_RenamePlace (Cns_ShrtOrFullName_t ShrtOrFullName)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_The_place_X_already_exists;
|
|
|
|
|
extern const char *Txt_The_place_X_has_been_renamed_as_Y;
|
|
|
|
|
extern const char *Txt_The_name_of_the_place_X_has_not_changed;
|
|
|
|
|
const char *ParamName = NULL; // Initialized to avoid warning
|
|
|
|
|
const char *FieldName = NULL; // Initialized to avoid warning
|
2017-03-07 19:55:29 +01:00
|
|
|
|
unsigned MaxBytes = 0; // Initialized to avoid warning
|
2014-12-01 23:55:08 +01:00
|
|
|
|
char *CurrentPlcName = NULL; // Initialized to avoid warning
|
2017-03-07 19:55:29 +01:00
|
|
|
|
char NewPlcName[Plc_MAX_BYTES_PLACE_FULL_NAME + 1];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2016-10-28 10:03:37 +02:00
|
|
|
|
switch (ShrtOrFullName)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2016-10-28 10:03:37 +02:00
|
|
|
|
case Cns_SHRT_NAME:
|
2014-12-01 23:55:08 +01:00
|
|
|
|
ParamName = "ShortName";
|
|
|
|
|
FieldName = "ShortName";
|
2017-03-07 19:55:29 +01:00
|
|
|
|
MaxBytes = Plc_MAX_BYTES_PLACE_SHRT_NAME;
|
2019-04-09 00:24:50 +02:00
|
|
|
|
CurrentPlcName = Plc_EditingPlc->ShrtName;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
break;
|
|
|
|
|
case Cns_FULL_NAME:
|
|
|
|
|
ParamName = "FullName";
|
|
|
|
|
FieldName = "FullName";
|
2017-03-07 19:55:29 +01:00
|
|
|
|
MaxBytes = Plc_MAX_BYTES_PLACE_FULL_NAME;
|
2019-04-09 00:24:50 +02:00
|
|
|
|
CurrentPlcName = Plc_EditingPlc->FullName;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Get parameters from form *****/
|
|
|
|
|
/* Get the code of the place */
|
2019-04-09 00:24:50 +02:00
|
|
|
|
if ((Plc_EditingPlc->PlcCod = Plc_GetParamPlcCod ()) == -1L)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Lay_ShowErrorAndExit ("Code of place is missing.");
|
|
|
|
|
|
|
|
|
|
/* Get the new name for the place */
|
2017-03-07 19:55:29 +01:00
|
|
|
|
Par_GetParToText (ParamName,NewPlcName,MaxBytes);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Get from the database the old names of the place *****/
|
2019-04-09 00:24:50 +02:00
|
|
|
|
Plc_GetDataOfPlaceByCod (Plc_EditingPlc);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Check if new name is empty *****/
|
2019-12-20 00:30:54 +01:00
|
|
|
|
if (NewPlcName[0])
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2019-01-02 15:10:51 +01:00
|
|
|
|
/***** Check if old and new names are the same
|
|
|
|
|
(this happens when return is pressed without changes) *****/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
if (strcmp (CurrentPlcName,NewPlcName)) // Different names
|
|
|
|
|
{
|
|
|
|
|
/***** If place was in database... *****/
|
2019-04-09 00:24:50 +02:00
|
|
|
|
if (Plc_CheckIfPlaceNameExists (ParamName,NewPlcName,Plc_EditingPlc->PlcCod))
|
|
|
|
|
Ale_CreateAlert (Ale_WARNING,NULL,
|
|
|
|
|
Txt_The_place_X_already_exists,
|
|
|
|
|
NewPlcName);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Update the table changing old name by new name */
|
2019-04-09 00:24:50 +02:00
|
|
|
|
Plc_UpdatePlcNameDB (Plc_EditingPlc->PlcCod,FieldName,NewPlcName);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-03-09 11:16:17 +01:00
|
|
|
|
/* Write message to show the change made */
|
2019-04-09 00:24:50 +02:00
|
|
|
|
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
|
|
|
|
Txt_The_place_X_has_been_renamed_as_Y,
|
|
|
|
|
CurrentPlcName,NewPlcName);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else // The same name
|
2019-04-09 00:24:50 +02:00
|
|
|
|
Ale_CreateAlert (Ale_INFO,NULL,
|
|
|
|
|
Txt_The_name_of_the_place_X_has_not_changed,
|
|
|
|
|
CurrentPlcName);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
2019-12-20 00:30:54 +01:00
|
|
|
|
else
|
|
|
|
|
Ale_CreateAlertYouCanNotLeaveFieldEmpty ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-04-09 00:24:50 +02:00
|
|
|
|
/***** Update place name *****/
|
2017-01-17 03:10:43 +01:00
|
|
|
|
Str_Copy (CurrentPlcName,NewPlcName,
|
2017-03-07 19:55:29 +01:00
|
|
|
|
MaxBytes);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************** Check if the name of place exists ********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static bool Plc_CheckIfPlaceNameExists (const char *FieldName,const char *Name,long PlcCod)
|
|
|
|
|
{
|
|
|
|
|
/***** Get number of places with a name from database *****/
|
2018-11-03 20:52:00 +01:00
|
|
|
|
return (DB_QueryCOUNT ("can not check if the name of a place"
|
|
|
|
|
" already existed",
|
|
|
|
|
"SELECT COUNT(*) FROM places"
|
|
|
|
|
" WHERE InsCod=%ld"
|
|
|
|
|
" AND %s='%s' AND PlcCod<>%ld",
|
2019-04-03 20:57:04 +02:00
|
|
|
|
Gbl.Hierarchy.Ins.InsCod,
|
2018-11-03 20:52:00 +01:00
|
|
|
|
FieldName,Name,PlcCod) != 0);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2017-03-09 11:16:17 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************** Update place name in table of places *********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Plc_UpdatePlcNameDB (long PlcCod,const char *FieldName,const char *NewPlcName)
|
|
|
|
|
{
|
|
|
|
|
/***** Update place changing old name by new name */
|
2018-11-03 12:16:40 +01:00
|
|
|
|
DB_QueryUPDATE ("can not update the name of a place",
|
|
|
|
|
"UPDATE places SET %s='%s' WHERE PlcCod=%ld",
|
|
|
|
|
FieldName,NewPlcName,PlcCod);
|
2017-03-09 11:16:17 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-09 00:24:50 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********** Show alerts after changing a place and continue editing **********/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Plc_ContEditAfterChgPlc (void)
|
|
|
|
|
{
|
|
|
|
|
/***** Write message to show the change made *****/
|
|
|
|
|
Ale_ShowAlerts (NULL);
|
|
|
|
|
|
|
|
|
|
/***** Show the form again *****/
|
|
|
|
|
Plc_EditPlacesInternal ();
|
|
|
|
|
|
|
|
|
|
/***** Place destructor *****/
|
|
|
|
|
Plc_EditingPlaceDestructor ();
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************* Put a form to create a new place **********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Plc_PutFormToCreatePlace (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_New_place;
|
|
|
|
|
extern const char *Txt_Create_place;
|
|
|
|
|
|
2019-10-20 22:00:28 +02:00
|
|
|
|
/***** Begin form *****/
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartForm (ActNewPlc);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-10-26 02:19:42 +02:00
|
|
|
|
/***** Begin box and table *****/
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Box_BoxTableBegin (NULL,Txt_New_place,
|
|
|
|
|
NULL,NULL,
|
2017-06-12 15:03:29 +02:00
|
|
|
|
NULL,Box_NOT_CLOSABLE,2);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Write heading *****/
|
2017-04-30 21:00:56 +02:00
|
|
|
|
Plc_PutHeadPlaces ();
|
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-09 21:05:58 +02:00
|
|
|
|
|
|
|
|
|
/***** Column to remove place, disabled here *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"BM\"");
|
|
|
|
|
HTM_TD_End ();
|
2017-04-30 21:00:56 +02:00
|
|
|
|
|
|
|
|
|
/***** Place code *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"CODE\"");
|
|
|
|
|
HTM_TD_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Place short name *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"CM\"");
|
2020-04-27 03:16:55 +02:00
|
|
|
|
HTM_INPUT_TEXT ("ShortName",Plc_MAX_CHARS_PLACE_SHRT_NAME,Plc_EditingPlc->ShrtName,
|
|
|
|
|
HTM_DONT_SUBMIT_ON_CHANGE,
|
2019-11-04 09:45:57 +01:00
|
|
|
|
"class=\"INPUT_SHORT_NAME\" required=\"required\"");
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Place full name *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"CM\"");
|
2020-04-27 03:16:55 +02:00
|
|
|
|
HTM_INPUT_TEXT ("FullName",Plc_MAX_CHARS_PLACE_FULL_NAME,Plc_EditingPlc->FullName,
|
|
|
|
|
HTM_DONT_SUBMIT_ON_CHANGE,
|
2019-11-04 09:45:57 +01:00
|
|
|
|
"class=\"INPUT_FULL_NAME\" required=\"required\"");
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-04-30 21:00:56 +02:00
|
|
|
|
/***** Number of centres *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"DAT RM\"");
|
2019-11-10 13:51:07 +01:00
|
|
|
|
HTM_Unsigned (0);
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_End ();
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2017-04-30 21:00:56 +02:00
|
|
|
|
|
2017-06-12 14:16:33 +02:00
|
|
|
|
/***** End table, send button and end box *****/
|
2019-11-25 23:18:08 +01:00
|
|
|
|
Box_BoxTableWithButtonEnd (Btn_CREATE_BUTTON,Txt_Create_place);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-06-12 14:16:33 +02:00
|
|
|
|
/***** End form *****/
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_EndForm ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************** Write header with fields of a place ********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Plc_PutHeadPlaces (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Code;
|
2015-02-04 20:03:23 +01:00
|
|
|
|
extern const char *Txt_Short_name;
|
|
|
|
|
extern const char *Txt_Full_name;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
extern const char *Txt_Centres;
|
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-12 00:07:52 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TH (1,1,"BM",NULL);
|
|
|
|
|
HTM_TH (1,1,"RM",Txt_Code);
|
|
|
|
|
HTM_TH (1,1,"LM",Txt_Short_name);
|
|
|
|
|
HTM_TH (1,1,"LM",Txt_Full_name);
|
|
|
|
|
HTM_TH (1,1,"RM",Txt_Centres);
|
2019-10-12 00:07:52 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************* Receive form to create a new place **********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-05-05 21:49:00 +02:00
|
|
|
|
void Plc_ReceiveFormNewPlace (void)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_The_place_X_already_exists;
|
2019-04-09 00:24:50 +02:00
|
|
|
|
extern const char *Txt_Created_new_place_X;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
extern const char *Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_place;
|
|
|
|
|
|
2019-04-09 00:24:50 +02:00
|
|
|
|
/***** Place constructor *****/
|
|
|
|
|
Plc_EditingPlaceConstructor ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Get parameters from form *****/
|
|
|
|
|
/* Get place short name */
|
2019-04-09 00:24:50 +02:00
|
|
|
|
Par_GetParToText ("ShortName",Plc_EditingPlc->ShrtName,Plc_MAX_BYTES_PLACE_SHRT_NAME);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Get place full name */
|
2019-04-09 00:24:50 +02:00
|
|
|
|
Par_GetParToText ("FullName",Plc_EditingPlc->FullName,Plc_MAX_BYTES_PLACE_FULL_NAME);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-04-09 00:24:50 +02:00
|
|
|
|
if (Plc_EditingPlc->ShrtName[0] &&
|
|
|
|
|
Plc_EditingPlc->FullName[0]) // If there's a place name
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
/***** If name of place was in database... *****/
|
2019-04-09 00:24:50 +02:00
|
|
|
|
if (Plc_CheckIfPlaceNameExists ("ShortName",Plc_EditingPlc->ShrtName,-1L))
|
|
|
|
|
Ale_CreateAlert (Ale_WARNING,NULL,
|
|
|
|
|
Txt_The_place_X_already_exists,
|
|
|
|
|
Plc_EditingPlc->ShrtName);
|
|
|
|
|
else if (Plc_CheckIfPlaceNameExists ("FullName",Plc_EditingPlc->FullName,-1L))
|
|
|
|
|
Ale_CreateAlert (Ale_WARNING,NULL,
|
|
|
|
|
Txt_The_place_X_already_exists,
|
|
|
|
|
Plc_EditingPlc->FullName);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
else // Add new place to database
|
2019-04-09 00:24:50 +02:00
|
|
|
|
{
|
|
|
|
|
Plc_CreatePlace (Plc_EditingPlc);
|
|
|
|
|
Ale_CreateAlert (Ale_SUCCESS,NULL,Txt_Created_new_place_X,
|
|
|
|
|
Plc_EditingPlc->FullName);
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
else // If there is not a place name
|
2019-04-09 00:24:50 +02:00
|
|
|
|
Ale_CreateAlert (Ale_WARNING,NULL,
|
|
|
|
|
Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_place);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**************************** Create a new place *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-13 21:26:47 +02:00
|
|
|
|
static void Plc_CreatePlace (struct Plc_Place *Plc)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Create a new place *****/
|
2018-11-02 19:37:11 +01:00
|
|
|
|
DB_QueryINSERT ("can not create place",
|
|
|
|
|
"INSERT INTO places"
|
|
|
|
|
" (InsCod,ShortName,FullName)"
|
|
|
|
|
" VALUES"
|
|
|
|
|
" (%ld,'%s','%s')",
|
2019-04-03 20:57:04 +02:00
|
|
|
|
Gbl.Hierarchy.Ins.InsCod,Plc->ShrtName,Plc->FullName);
|
2019-04-09 00:24:50 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************* Place constructor/destructor **********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Plc_EditingPlaceConstructor (void)
|
|
|
|
|
{
|
|
|
|
|
/***** Pointer must be NULL *****/
|
|
|
|
|
if (Plc_EditingPlc != NULL)
|
|
|
|
|
Lay_ShowErrorAndExit ("Error initializing place.");
|
|
|
|
|
|
|
|
|
|
/***** Allocate memory for place *****/
|
2020-04-13 21:26:47 +02:00
|
|
|
|
if ((Plc_EditingPlc = (struct Plc_Place *) malloc (sizeof (struct Plc_Place))) == NULL)
|
2019-04-09 00:24:50 +02:00
|
|
|
|
Lay_ShowErrorAndExit ("Error allocating memory for place.");
|
|
|
|
|
|
|
|
|
|
/***** Reset place *****/
|
|
|
|
|
Plc_EditingPlc->PlcCod = -1L;
|
|
|
|
|
Plc_EditingPlc->InsCod = -1L;
|
|
|
|
|
Plc_EditingPlc->ShrtName[0] = '\0';
|
|
|
|
|
Plc_EditingPlc->FullName[0] = '\0';
|
|
|
|
|
Plc_EditingPlc->NumCtrs = 0;
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-04-09 00:24:50 +02:00
|
|
|
|
static void Plc_EditingPlaceDestructor (void)
|
|
|
|
|
{
|
|
|
|
|
/***** Free memory used for place *****/
|
|
|
|
|
if (Plc_EditingPlc != NULL)
|
|
|
|
|
{
|
2019-11-06 19:45:20 +01:00
|
|
|
|
free (Plc_EditingPlc);
|
2019-04-09 00:24:50 +02:00
|
|
|
|
Plc_EditingPlc = NULL;
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|