diff --git a/Makefile b/Makefile index 974818b7..94db7ec1 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,7 @@ OBJS = swad_account.o swad_account_database.o swad_action.o swad_admin.o \ swad_help.o swad_hierarchy.o swad_hierarchy_config.o swad_holiday.o \ swad_HTML.o \ swad_icon.o swad_ID.o swad_indicator.o swad_info.o swad_institution.o \ - swad_institution_config.o \ + swad_institution_config.o swad_institution_database.o \ swad_language.o swad_layout.o swad_link.o swad_log.o swad_logo.o \ swad_MAC.o swad_mail.o swad_main.o swad_maintenance.o swad_map.o \ swad_mark.o swad_match.o swad_match_print.o swad_match_result.o \ diff --git a/swad_changelog.h b/swad_changelog.h index 1e4869c6..6186c7db 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -602,13 +602,14 @@ TODO: FIX BUG, URGENT! En las fechas como par TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo. */ -#define Log_PLATFORM_VERSION "SWAD 20.97 (2021-09-10)" +#define Log_PLATFORM_VERSION "SWAD 20.98 (2021-09-10)" #define CSS_FILE "swad20.45.css" #define JS_FILE "swad20.69.1.js" /* TODO: Rename CENTRE to CENTER in help wiki. TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams + Version 20.98: Sep 10, 2021 New module swad_institution_database for database queries related to institutions. (314663 lines) Version 20.97: Sep 10, 2021 Code refactoring related to scope. (314566 lines) Version 20.96.7: Sep 09, 2021 Queries moved to module swad_exam_database. (314527 lines) Version 20.96.6: Sep 09, 2021 Queries moved to module swad_exam_database. (314471 lines) diff --git a/swad_institution.c b/swad_institution.c index 357117f3..309ef7be 100644 --- a/swad_institution.c +++ b/swad_institution.c @@ -44,6 +44,7 @@ #include "swad_hierarchy_level.h" #include "swad_HTML.h" #include "swad_institution.h" +#include "swad_institution_database.h" #include "swad_logo.h" #include "swad_message.h" #include "swad_place.h" @@ -106,7 +107,6 @@ static void Ins_PutParamGoToIns (void *InsCod); static void Ins_PutFormToCreateInstitution (void); static void Ins_PutHeadInstitutionsForEdition (void); static void Ins_ReceiveFormRequestOrCreateIns (unsigned Status); -static long Ins_DB_CreateInstitution (const struct Ins_Instit *Ins,unsigned Status); static void Ins_EditingInstitutionConstructor (); static void Ins_EditingInstitutionDestructor (); @@ -858,28 +858,6 @@ static void Ins_GetDataOfInstitFromRow (struct Ins_Instit *Ins,MYSQL_ROW row) Str_Copy (Ins->WWW ,row[6],sizeof (Ins->WWW ) - 1); } -/*****************************************************************************/ -/*********** Get the short name of an institution from its code **************/ -/*****************************************************************************/ - -void Ins_DB_GetShortNameOfInstitution (long InsCod,char ShrtName[Cns_HIERARCHY_MAX_BYTES_SHRT_NAME + 1]) - { - /***** Trivial check: institution code should be > 0 *****/ - if (InsCod <= 0) - { - ShrtName[0] = '\0'; // Empty name - return; - } - - /***** Get short name of institution from database *****/ - DB_QuerySELECTString (ShrtName,Cns_HIERARCHY_MAX_BYTES_SHRT_NAME, - "can not get the short name of an institution", - "SELECT ShortName" - " FROM ins_instits" - " WHERE InsCod=%ld", - InsCod); - } - /*****************************************************************************/ /************ Get the full name of an institution from its code **************/ /*****************************************************************************/ @@ -1496,26 +1474,6 @@ void Ins_RenameInstitution (struct Ins_Instit *Ins,Cns_ShrtOrFullName_t ShrtOrFu Ale_CreateAlertYouCanNotLeaveFieldEmpty (); } -/*****************************************************************************/ -/****** Check if the name of institution exists in the current country *******/ -/*****************************************************************************/ - -bool Ins_DB_CheckIfInsNameExistsInCty (const char *FieldName, - const char *Name, - long InsCod, - long CtyCod) - { - /***** Get number of institutions in current country with a name from database *****/ - return (DB_QueryCOUNT ("can not check if the name of an institution" - " already existed", - "SELECT COUNT(*)" - " FROM ins_instits" - " WHERE CtyCod=%ld" - " AND %s='%s'" - " AND InsCod<>%ld", - CtyCod,FieldName,Name,InsCod) != 0); - } - /*****************************************************************************/ /************ Update institution name in table of institutions ***************/ /*****************************************************************************/ @@ -1573,21 +1531,6 @@ void Ins_ChangeInsWWW (void) Ale_CreateAlertYouCanNotLeaveFieldEmpty (); } -/*****************************************************************************/ -/**************** Update database changing old WWW by new WWW ****************/ -/*****************************************************************************/ - -void Ins_DB_UpdateInsWWW (long InsCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1]) - { - /***** Update database changing old WWW by new WWW *****/ - DB_QueryUPDATE ("can not update the web of an institution", - "UPDATE ins_instits" - " SET WWW='%s'" - " WHERE InsCod=%ld", - NewWWW, - InsCod); - } - /*****************************************************************************/ /******************** Change the status of an institution ********************/ /*****************************************************************************/ @@ -1893,28 +1836,6 @@ static void Ins_ReceiveFormRequestOrCreateIns (unsigned Status) Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_institution); } -/*****************************************************************************/ -/************************** Create a new institution *************************/ -/*****************************************************************************/ - -static long Ins_DB_CreateInstitution (const struct Ins_Instit *Ins,unsigned Status) - { - return - DB_QueryINSERTandReturnCode ("can not create institution", - "INSERT INTO ins_instits" - " (CtyCod,Status,RequesterUsrCod," - "ShortName,FullName,WWW)" - " VALUES" - " (%ld,%u,%ld," - "'%s','%s','%s')", - Ins->CtyCod, - Status, - Gbl.Usrs.Me.UsrDat.UsrCod, - Ins->ShrtName, - Ins->FullName, - Ins->WWW); - } - /*****************************************************************************/ /********************* Get total number of institutions **********************/ /*****************************************************************************/ @@ -2001,25 +1922,6 @@ unsigned Ins_GetCachedNumInssWithCtrs (void) return NumInssWithCtrs; } -/*****************************************************************************/ -/****************** Get number of institutions with centres ******************/ -/*****************************************************************************/ - -unsigned Ins_DB_GetNumInssWithCtrs (HieLvl_Level_t Scope,long Cod) - { - char SubQuery[128]; - - Hie_DB_BuildSubquery (SubQuery,Scope,Cod); - - return (unsigned) - DB_QueryCOUNT ("can not get number of institutions with centers", - "SELECT COUNT(DISTINCT ins_instits.InsCod)" - " FROM ins_instits," - "ctr_centers" - " WHERE %sinstitutions.InsCod=ctr_centers.InsCod", - SubQuery); - } - /*****************************************************************************/ /****************** Get number of institutions with degrees ******************/ /*****************************************************************************/ @@ -2042,27 +1944,6 @@ unsigned Ins_GetCachedNumInssWithDegs (void) return NumInssWithDegs; } -/*****************************************************************************/ -/****************** Get number of institutions with degrees ******************/ -/*****************************************************************************/ - -unsigned Ins_DB_GetNumInssWithDegs (HieLvl_Level_t Scope,long Cod) - { - char SubQuery[128]; - - Hie_DB_BuildSubquery (SubQuery,Scope,Cod); - - return (unsigned) - DB_QueryCOUNT ("can not get number of institutions with degrees", - "SELECT COUNT(DISTINCT ins_instits.InsCod)" - " FROM ins_instits," - "ctr_centers," - "deg_degrees" - " WHERE %sinstitutions.InsCod=ctr_centers.InsCod" - " AND ctr_centers.CtrCod=deg_degrees.CtrCod", - SubQuery); - } - /*****************************************************************************/ /****************** Get number of institutions with courses ******************/ /*****************************************************************************/ @@ -2085,29 +1966,6 @@ unsigned Ins_GetCachedNumInssWithCrss (void) return NumInssWithCrss; } -/*****************************************************************************/ -/****************** Get number of institutions with courses ******************/ -/*****************************************************************************/ - -unsigned Ins_DB_GetNumInssWithCrss (HieLvl_Level_t Scope,long Cod) - { - char SubQuery[128]; - - Hie_DB_BuildSubquery (SubQuery,Scope,Cod); - - return (unsigned) - DB_QueryCOUNT ("can not get number of institutions with courses", - "SELECT COUNT(DISTINCT ins_instits.InsCod)" - " FROM ins_instits," - "ctr_centers," - "deg_degrees," - "crs_courses" - " WHERE %sinstitutions.InsCod=ctr_centers.InsCod" - " AND ctr_centers.CtrCod=deg_degrees.CtrCod" - " AND deg_degrees.DegCod=crs_courses.DegCod", - SubQuery); - } - /*****************************************************************************/ /****************** Get number of institutions with users ********************/ /*****************************************************************************/ @@ -2136,34 +1994,6 @@ unsigned Ins_GetCachedNumInssWithUsrs (Rol_Role_t Role) return NumInssWithUsrs; } -/*****************************************************************************/ -/************* Get current number of institutions with users *****************/ -/*****************************************************************************/ - -unsigned Ins_DB_GetNumInnsWithUsrs (Rol_Role_t Role, - HieLvl_Level_t Scope,long Cod) - { - char SubQuery[128]; - - Hie_DB_BuildSubquery (SubQuery,Scope,Cod); - - return (unsigned) - DB_QueryCOUNT ("can not get number of institutions with users", - "SELECT COUNT(DISTINCT ins_instits.InsCod)" - " FROM ins_instits," - "ctr_centers," - "deg_degrees," - "crs_courses," - "crs_users" - " WHERE %s" - "ins_instits.InsCod=ctr_centers.InsCod" - " AND ctr_centers.CtrCod=deg_degrees.CtrCod" - " AND deg_degrees.DegCod=crs_courses.DegCod" - " AND crs_courses.CrsCod=crs_users.CrsCod" - " AND crs_users.Role=%u", - SubQuery,(unsigned) Role); - } - /*****************************************************************************/ /*************************** List institutions found *************************/ /*****************************************************************************/ diff --git a/swad_institution.h b/swad_institution.h index f36f44d2..f835d46b 100644 --- a/swad_institution.h +++ b/swad_institution.h @@ -104,7 +104,6 @@ void Ins_GetFullListOfInstitutions (long CtyCod); void Ins_WriteInstitutionNameAndCty (long InsCod); bool Ins_GetDataOfInstitutionByCod (struct Ins_Instit *Ins); -void Ins_DB_GetShortNameOfInstitution (long InsCod,char ShrtName[Cns_HIERARCHY_MAX_BYTES_SHRT_NAME + 1]); void Ins_FlushCacheFullNameAndCtyOfInstitution (void); void Ins_FreeListInstitutions (void); @@ -116,12 +115,7 @@ void Ins_RemoveInstitution (void); void Ins_RenameInsShort (void); void Ins_RenameInsFull (void); void Ins_RenameInstitution (struct Ins_Instit *Ins,Cns_ShrtOrFullName_t ShrtOrFullName); -bool Ins_DB_CheckIfInsNameExistsInCty (const char *FieldName, - const char *Name, - long InsCod, - long CtyCod); void Ins_ChangeInsWWW (void); -void Ins_DB_UpdateInsWWW (long InsCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1]); void Ins_ChangeInsStatus (void); void Ins_ContEditAfterChgIns (void); @@ -135,14 +129,9 @@ unsigned Ins_GetNumInssInCty (long CtyCod); unsigned Ins_GetCachedNumInssInCty (long CtyCod); unsigned Ins_GetCachedNumInssWithCtrs (void); -unsigned Ins_DB_GetNumInssWithCtrs (HieLvl_Level_t Scope,long Cod); unsigned Ins_GetCachedNumInssWithDegs (void); -unsigned Ins_DB_GetNumInssWithDegs (HieLvl_Level_t Scope,long Cod); unsigned Ins_GetCachedNumInssWithCrss (void); -unsigned Ins_DB_GetNumInssWithCrss (HieLvl_Level_t Scope,long Cod); unsigned Ins_GetCachedNumInssWithUsrs (Rol_Role_t Role); -unsigned Ins_DB_GetNumInnsWithUsrs (Rol_Role_t Role, - HieLvl_Level_t Scope,long Cod); void Ins_ListInssFound (MYSQL_RES **mysql_res,unsigned NumInss); diff --git a/swad_institution_config.c b/swad_institution_config.c index 3f49ad16..1a490222 100644 --- a/swad_institution_config.c +++ b/swad_institution_config.c @@ -43,6 +43,7 @@ #include "swad_hierarchy_level.h" #include "swad_HTML.h" #include "swad_institution.h" +#include "swad_institution_database.h" #include "swad_logo.h" #include "swad_place.h" @@ -83,7 +84,6 @@ static void InsCfg_NumUsrs (void); static void InsCfg_NumDegs (void); static void InsCfg_NumCrss (void); static void InsCfg_NumDpts (void); -static void InsCfg_UpdateInsCtyDB (long InsCod,long CtyCod); /*****************************************************************************/ /*************** Show information of the current institution *****************/ @@ -599,7 +599,7 @@ void InsCfg_ChangeInsCty (void) else { /***** Update the table changing the country of the institution *****/ - InsCfg_UpdateInsCtyDB (Gbl.Hierarchy.Ins.InsCod,NewCty.CtyCod); + Ins_DB_UpdateInsCty (Gbl.Hierarchy.Ins.InsCod,NewCty.CtyCod); Gbl.Hierarchy.Ins.CtyCod = Gbl.Hierarchy.Cty.CtyCod = NewCty.CtyCod; @@ -614,21 +614,6 @@ void InsCfg_ChangeInsCty (void) } } -/*****************************************************************************/ -/****************** Update country in table of institutions ******************/ -/*****************************************************************************/ - -static void InsCfg_UpdateInsCtyDB (long InsCod,long CtyCod) - { - /***** Update country in table of institutions *****/ - DB_QueryUPDATE ("can not update the country of an institution", - "UPDATE ins_instits" - " SET CtyCod=%ld" - " WHERE InsCod=%ld", - CtyCod, - InsCod); - } - /*****************************************************************************/ /************ Change the name of an institution in configuration *************/ /*****************************************************************************/ diff --git a/swad_institution_database.c b/swad_institution_database.c new file mode 100644 index 00000000..c0f381b4 --- /dev/null +++ b/swad_institution_database.c @@ -0,0 +1,258 @@ +// swad_institution_database.c: institutions operations with database + +/* + 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. + Copyright (C) 1999-2021 Antonio Caņas Vargas + + 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 . +*/ +/*****************************************************************************/ +/********************************* Headers ***********************************/ +/*****************************************************************************/ + +// #include // For boolean type +// #include // For NULL +// #include // For free +// #include // For string functions + +// #include "swad_admin_database.h" +#include "swad_database.h" +// #include "swad_department.h" +// #include "swad_enrolment_database.h" +// #include "swad_error.h" +// #include "swad_figure.h" +// #include "swad_figure_cache.h" +// #include "swad_form.h" +// #include "swad_forum.h" +#include "swad_global.h" +#include "swad_hierarchy.h" +// #include "swad_hierarchy_level.h" +// #include "swad_HTML.h" +#include "swad_institution.h" +#include "swad_institution_database.h" +// #include "swad_logo.h" +// #include "swad_message.h" +// #include "swad_place.h" +// #include "swad_survey.h" + +/*****************************************************************************/ +/************** External global variables from others modules ****************/ +/*****************************************************************************/ + +extern struct Globals Gbl; + +/*****************************************************************************/ +/***************************** Private constants *****************************/ +/*****************************************************************************/ + +/*****************************************************************************/ +/******************************* Private types *******************************/ +/*****************************************************************************/ + +/*****************************************************************************/ +/***************************** Private variables *****************************/ +/*****************************************************************************/ + +/*****************************************************************************/ +/***************************** Private prototypes ****************************/ +/*****************************************************************************/ + +/*****************************************************************************/ +/************************** Create a new institution *************************/ +/*****************************************************************************/ + +long Ins_DB_CreateInstitution (const struct Ins_Instit *Ins,unsigned Status) + { + return + DB_QueryINSERTandReturnCode ("can not create institution", + "INSERT INTO ins_instits" + " (CtyCod,Status,RequesterUsrCod," + "ShortName,FullName,WWW)" + " VALUES" + " (%ld,%u,%ld," + "'%s','%s','%s')", + Ins->CtyCod, + Status, + Gbl.Usrs.Me.UsrDat.UsrCod, + Ins->ShrtName, + Ins->FullName, + Ins->WWW); + } + +/*****************************************************************************/ +/****************** Update country in table of institutions ******************/ +/*****************************************************************************/ + +void Ins_DB_UpdateInsCty (long InsCod,long CtyCod) + { + /***** Update country in table of institutions *****/ + DB_QueryUPDATE ("can not update the country of an institution", + "UPDATE ins_instits" + " SET CtyCod=%ld" + " WHERE InsCod=%ld", + CtyCod, + InsCod); + } + +/*****************************************************************************/ +/**************** Update database changing old WWW by new WWW ****************/ +/*****************************************************************************/ + +void Ins_DB_UpdateInsWWW (long InsCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1]) + { + /***** Update database changing old WWW by new WWW *****/ + DB_QueryUPDATE ("can not update the web of an institution", + "UPDATE ins_instits" + " SET WWW='%s'" + " WHERE InsCod=%ld", + NewWWW, + InsCod); + } + +/*****************************************************************************/ +/*********** Get the short name of an institution from its code **************/ +/*****************************************************************************/ + +void Ins_DB_GetShortNameOfInstitution (long InsCod,char ShrtName[Cns_HIERARCHY_MAX_BYTES_SHRT_NAME + 1]) + { + /***** Trivial check: institution code should be > 0 *****/ + if (InsCod <= 0) + { + ShrtName[0] = '\0'; // Empty name + return; + } + + /***** Get short name of institution from database *****/ + DB_QuerySELECTString (ShrtName,Cns_HIERARCHY_MAX_BYTES_SHRT_NAME, + "can not get the short name of an institution", + "SELECT ShortName" + " FROM ins_instits" + " WHERE InsCod=%ld", + InsCod); + } + +/*****************************************************************************/ +/****** Check if the name of institution exists in the current country *******/ +/*****************************************************************************/ + +bool Ins_DB_CheckIfInsNameExistsInCty (const char *FieldName, + const char *Name, + long InsCod, + long CtyCod) + { + /***** Get number of institutions in current country with a name from database *****/ + return (DB_QueryCOUNT ("can not check if the name of an institution" + " already existed", + "SELECT COUNT(*)" + " FROM ins_instits" + " WHERE CtyCod=%ld" + " AND %s='%s'" + " AND InsCod<>%ld", + CtyCod,FieldName,Name,InsCod) != 0); + } + +/*****************************************************************************/ +/****************** Get number of institutions with centres ******************/ +/*****************************************************************************/ + +unsigned Ins_DB_GetNumInssWithCtrs (HieLvl_Level_t Scope,long Cod) + { + char SubQuery[128]; + + Hie_DB_BuildSubquery (SubQuery,Scope,Cod); + + return (unsigned) + DB_QueryCOUNT ("can not get number of institutions with centers", + "SELECT COUNT(DISTINCT ins_instits.InsCod)" + " FROM ins_instits," + "ctr_centers" + " WHERE %sinstitutions.InsCod=ctr_centers.InsCod", + SubQuery); + } + +/*****************************************************************************/ +/****************** Get number of institutions with degrees ******************/ +/*****************************************************************************/ + +unsigned Ins_DB_GetNumInssWithDegs (HieLvl_Level_t Scope,long Cod) + { + char SubQuery[128]; + + Hie_DB_BuildSubquery (SubQuery,Scope,Cod); + + return (unsigned) + DB_QueryCOUNT ("can not get number of institutions with degrees", + "SELECT COUNT(DISTINCT ins_instits.InsCod)" + " FROM ins_instits," + "ctr_centers," + "deg_degrees" + " WHERE %sinstitutions.InsCod=ctr_centers.InsCod" + " AND ctr_centers.CtrCod=deg_degrees.CtrCod", + SubQuery); + } + +/*****************************************************************************/ +/****************** Get number of institutions with courses ******************/ +/*****************************************************************************/ + +unsigned Ins_DB_GetNumInssWithCrss (HieLvl_Level_t Scope,long Cod) + { + char SubQuery[128]; + + Hie_DB_BuildSubquery (SubQuery,Scope,Cod); + + return (unsigned) + DB_QueryCOUNT ("can not get number of institutions with courses", + "SELECT COUNT(DISTINCT ins_instits.InsCod)" + " FROM ins_instits," + "ctr_centers," + "deg_degrees," + "crs_courses" + " WHERE %sinstitutions.InsCod=ctr_centers.InsCod" + " AND ctr_centers.CtrCod=deg_degrees.CtrCod" + " AND deg_degrees.DegCod=crs_courses.DegCod", + SubQuery); + } + +/*****************************************************************************/ +/************* Get current number of institutions with users *****************/ +/*****************************************************************************/ + +unsigned Ins_DB_GetNumInnsWithUsrs (Rol_Role_t Role, + HieLvl_Level_t Scope,long Cod) + { + char SubQuery[128]; + + Hie_DB_BuildSubquery (SubQuery,Scope,Cod); + + return (unsigned) + DB_QueryCOUNT ("can not get number of institutions with users", + "SELECT COUNT(DISTINCT ins_instits.InsCod)" + " FROM ins_instits," + "ctr_centers," + "deg_degrees," + "crs_courses," + "crs_users" + " WHERE %s" + "ins_instits.InsCod=ctr_centers.InsCod" + " AND ctr_centers.CtrCod=deg_degrees.CtrCod" + " AND deg_degrees.DegCod=crs_courses.DegCod" + " AND crs_courses.CrsCod=crs_users.CrsCod" + " AND crs_users.Role=%u", + SubQuery,(unsigned) Role); + } diff --git a/swad_institution_database.h b/swad_institution_database.h new file mode 100644 index 00000000..31e197ff --- /dev/null +++ b/swad_institution_database.h @@ -0,0 +1,58 @@ +// swad_institution_database.h: institutions operations with database + +#ifndef _SWAD_INS_DB +#define _SWAD_INS_DB +/* + SWAD (Shared Workspace At a Distance in Spanish), + is a web platform developed at the University of Granada (Spain), + and used to support university teaching. + + This file is part of SWAD core. + Copyright (C) 1999-2021 Antonio Caņas Vargas + + 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 . +*/ +/*****************************************************************************/ +/********************************** Headers **********************************/ +/*****************************************************************************/ + +#include "swad_constant.h" +#include "swad_hierarchy_level.h" +#include "swad_role_type.h" + +/*****************************************************************************/ +/************************ Public types and constants *************************/ +/*****************************************************************************/ + +/*****************************************************************************/ +/***************************** Public prototypes *****************************/ +/*****************************************************************************/ + +long Ins_DB_CreateInstitution (const struct Ins_Instit *Ins,unsigned Status); +void Ins_DB_UpdateInsCty (long InsCod,long CtyCod); +void Ins_DB_UpdateInsWWW (long InsCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1]); + +void Ins_DB_GetShortNameOfInstitution (long InsCod,char ShrtName[Cns_HIERARCHY_MAX_BYTES_SHRT_NAME + 1]); +bool Ins_DB_CheckIfInsNameExistsInCty (const char *FieldName, + const char *Name, + long InsCod, + long CtyCod); + +unsigned Ins_DB_GetNumInssWithCtrs (HieLvl_Level_t Scope,long Cod); +unsigned Ins_DB_GetNumInssWithDegs (HieLvl_Level_t Scope,long Cod); +unsigned Ins_DB_GetNumInssWithCrss (HieLvl_Level_t Scope,long Cod); +unsigned Ins_DB_GetNumInnsWithUsrs (Rol_Role_t Role, + HieLvl_Level_t Scope,long Cod); + +#endif diff --git a/swad_log.c b/swad_log.c index 08a9fc59..82331224 100644 --- a/swad_log.c +++ b/swad_log.c @@ -38,6 +38,7 @@ #include "swad_global.h" #include "swad_hierarchy.h" #include "swad_HTML.h" +#include "swad_institution_database.h" #include "swad_log.h" #include "swad_profile.h" #include "swad_role.h"