mirror of https://github.com/acanas/swad-core.git
Version 16.31
This commit is contained in:
parent
47be015538
commit
5e81147246
|
@ -182,6 +182,7 @@ Institution:
|
|||
|
||||
84. ActPrnInsInf Print information on the current institution
|
||||
85. ActChgInsCtyCfg Change country of institution in institution configuration
|
||||
NEW. ActRenInsFulCfg Change full name of institution in institution configuration
|
||||
86. ActReqInsLog Show form to send the logo of the current institution
|
||||
87. ActRecInsLog Receive and store the logo of the current institution
|
||||
88. ActRemInsLog Remove the logo of the current institution
|
||||
|
@ -1525,7 +1526,8 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
|||
/* ActInsSch */{1182,-1,TabUnk,ActInsReqSch ,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,Sch_GetParamsSearch ,Sch_InsSearch ,NULL},
|
||||
|
||||
/* ActPrnInsInf */{1154,-1,TabUnk,ActSeeInsInf ,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_BLNK_WINDOW,NULL ,Ins_PrintConfiguration ,NULL},
|
||||
/* ActChgInsCtyCfg */{1590,-1,TabUnk,ActSeeIns ,0x100,0x100,0x100,Act_CONT_NORM,Act_THIS_WINDOW,Ins_ChangeInsCtyInConfig ,Ins_ContEditAfterChgInsInConfig,NULL},
|
||||
/* ActChgInsCtyCfg */{1590,-1,TabUnk,ActSeeInsInf ,0x100,0x100,0x100,Act_CONT_NORM,Act_THIS_WINDOW,Ins_ChangeInsCtyInConfig ,Ins_ContEditAfterChgInsInConfig,NULL},
|
||||
/* ActRenInsFulCfg */{1591,-1,TabUnk,ActSeeInsInf ,0x100,0x100,0x100,Act_CONT_NORM,Act_THIS_WINDOW,Ins_RenameInsFullInConfig ,Ins_ContEditAfterChgInsInConfig,NULL},
|
||||
/* ActReqInsLog */{1245,-1,TabUnk,ActSeeInsInf ,0x100,0x100,0x100,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Ins_RequestLogo ,NULL},
|
||||
/* ActRecInsLog */{ 699,-1,TabUnk,ActSeeInsInf ,0x100,0x100,0x100,Act_CONT_DATA,Act_THIS_WINDOW,Ins_ReceiveLogo ,Ins_ShowConfiguration ,NULL},
|
||||
/* ActRemInsLog */{1341,-1,TabUnk,ActSeeInsInf ,0x100,0x100,0x100,Act_CONT_DATA,Act_THIS_WINDOW,Ins_RemoveLogo ,Ins_ShowConfiguration ,NULL},
|
||||
|
@ -4440,6 +4442,7 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq
|
|||
ActChgDegCtrCfg, // #1588
|
||||
ActChgCtrInsCfg, // #1589
|
||||
ActChgInsCtyCfg, // #1590
|
||||
ActRenInsFulCfg, // #1591
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
163
swad_action.h
163
swad_action.h
|
@ -55,9 +55,9 @@ typedef enum
|
|||
|
||||
typedef int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action
|
||||
|
||||
#define Act_NUM_ACTIONS (1+9+51+14+90+70+67+247+186+155+172+36+30+86)
|
||||
#define Act_NUM_ACTIONS (1+9+51+14+91+70+67+247+186+155+172+36+30+86)
|
||||
|
||||
#define Act_MAX_ACTION_COD 1590
|
||||
#define Act_MAX_ACTION_COD 1591
|
||||
|
||||
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 20
|
||||
|
||||
|
@ -182,91 +182,92 @@ typedef int Act_Action_t; // Must be a signed type, because -1 is used to indica
|
|||
#define ActInsSch (ActChgInsSta+ 9)
|
||||
#define ActPrnInsInf (ActChgInsSta+ 10)
|
||||
#define ActChgInsCtyCfg (ActChgInsSta+ 11)
|
||||
#define ActReqInsLog (ActChgInsSta+ 12)
|
||||
#define ActRecInsLog (ActChgInsSta+ 13)
|
||||
#define ActRemInsLog (ActChgInsSta+ 14)
|
||||
#define ActRenInsFulCfg (ActChgInsSta+ 12)
|
||||
#define ActReqInsLog (ActChgInsSta+ 13)
|
||||
#define ActRecInsLog (ActChgInsSta+ 14)
|
||||
#define ActRemInsLog (ActChgInsSta+ 15)
|
||||
|
||||
#define ActEdiCtr (ActChgInsSta+ 15)
|
||||
#define ActReqCtr (ActChgInsSta+ 16)
|
||||
#define ActNewCtr (ActChgInsSta+ 17)
|
||||
#define ActRemCtr (ActChgInsSta+ 18)
|
||||
#define ActChgCtrPlc (ActChgInsSta+ 19)
|
||||
#define ActRenCtrSho (ActChgInsSta+ 20)
|
||||
#define ActRenCtrFul (ActChgInsSta+ 21)
|
||||
#define ActChgCtrWWW (ActChgInsSta+ 22)
|
||||
#define ActChgCtrSta (ActChgInsSta+ 23)
|
||||
#define ActEdiCtr (ActChgInsSta+ 16)
|
||||
#define ActReqCtr (ActChgInsSta+ 17)
|
||||
#define ActNewCtr (ActChgInsSta+ 18)
|
||||
#define ActRemCtr (ActChgInsSta+ 19)
|
||||
#define ActChgCtrPlc (ActChgInsSta+ 20)
|
||||
#define ActRenCtrSho (ActChgInsSta+ 21)
|
||||
#define ActRenCtrFul (ActChgInsSta+ 22)
|
||||
#define ActChgCtrWWW (ActChgInsSta+ 23)
|
||||
#define ActChgCtrSta (ActChgInsSta+ 24)
|
||||
|
||||
#define ActEdiDpt (ActChgInsSta+ 24)
|
||||
#define ActNewDpt (ActChgInsSta+ 25)
|
||||
#define ActRemDpt (ActChgInsSta+ 26)
|
||||
#define ActChgDptIns (ActChgInsSta+ 27)
|
||||
#define ActRenDptSho (ActChgInsSta+ 28)
|
||||
#define ActRenDptFul (ActChgInsSta+ 29)
|
||||
#define ActChgDptWWW (ActChgInsSta+ 30)
|
||||
#define ActEdiDpt (ActChgInsSta+ 25)
|
||||
#define ActNewDpt (ActChgInsSta+ 26)
|
||||
#define ActRemDpt (ActChgInsSta+ 27)
|
||||
#define ActChgDptIns (ActChgInsSta+ 28)
|
||||
#define ActRenDptSho (ActChgInsSta+ 29)
|
||||
#define ActRenDptFul (ActChgInsSta+ 30)
|
||||
#define ActChgDptWWW (ActChgInsSta+ 31)
|
||||
|
||||
#define ActEdiPlc (ActChgInsSta+ 31)
|
||||
#define ActNewPlc (ActChgInsSta+ 32)
|
||||
#define ActRemPlc (ActChgInsSta+ 33)
|
||||
#define ActRenPlcSho (ActChgInsSta+ 34)
|
||||
#define ActRenPlcFul (ActChgInsSta+ 35)
|
||||
#define ActEdiPlc (ActChgInsSta+ 32)
|
||||
#define ActNewPlc (ActChgInsSta+ 33)
|
||||
#define ActRemPlc (ActChgInsSta+ 34)
|
||||
#define ActRenPlcSho (ActChgInsSta+ 35)
|
||||
#define ActRenPlcFul (ActChgInsSta+ 36)
|
||||
|
||||
#define ActEdiHld (ActChgInsSta+ 36)
|
||||
#define ActNewHld (ActChgInsSta+ 37)
|
||||
#define ActRemHld (ActChgInsSta+ 38)
|
||||
#define ActChgHldPlc (ActChgInsSta+ 39)
|
||||
#define ActChgHldTyp (ActChgInsSta+ 40)
|
||||
#define ActChgHldStrDat (ActChgInsSta+ 41)
|
||||
#define ActChgHldEndDat (ActChgInsSta+ 42)
|
||||
#define ActRenHld (ActChgInsSta+ 43)
|
||||
#define ActEdiHld (ActChgInsSta+ 37)
|
||||
#define ActNewHld (ActChgInsSta+ 38)
|
||||
#define ActRemHld (ActChgInsSta+ 39)
|
||||
#define ActChgHldPlc (ActChgInsSta+ 40)
|
||||
#define ActChgHldTyp (ActChgInsSta+ 41)
|
||||
#define ActChgHldStrDat (ActChgInsSta+ 42)
|
||||
#define ActChgHldEndDat (ActChgInsSta+ 43)
|
||||
#define ActRenHld (ActChgInsSta+ 44)
|
||||
|
||||
#define ActChgToSeeDocIns (ActChgInsSta+ 44)
|
||||
#define ActSeeDocIns (ActChgInsSta+ 45)
|
||||
#define ActExpSeeDocIns (ActChgInsSta+ 46)
|
||||
#define ActConSeeDocIns (ActChgInsSta+ 47)
|
||||
#define ActZIPSeeDocIns (ActChgInsSta+ 48)
|
||||
#define ActReqDatSeeDocIns (ActChgInsSta+ 49)
|
||||
#define ActDowSeeDocIns (ActChgInsSta+ 50)
|
||||
#define ActChgToAdmDocIns (ActChgInsSta+ 51)
|
||||
#define ActAdmDocIns (ActChgInsSta+ 52)
|
||||
#define ActReqRemFilDocIns (ActChgInsSta+ 53)
|
||||
#define ActRemFilDocIns (ActChgInsSta+ 54)
|
||||
#define ActRemFolDocIns (ActChgInsSta+ 55)
|
||||
#define ActCopDocIns (ActChgInsSta+ 56)
|
||||
#define ActPasDocIns (ActChgInsSta+ 57)
|
||||
#define ActRemTreDocIns (ActChgInsSta+ 58)
|
||||
#define ActFrmCreDocIns (ActChgInsSta+ 59)
|
||||
#define ActCreFolDocIns (ActChgInsSta+ 60)
|
||||
#define ActCreLnkDocIns (ActChgInsSta+ 61)
|
||||
#define ActRenFolDocIns (ActChgInsSta+ 62)
|
||||
#define ActRcvFilDocInsDZ (ActChgInsSta+ 63)
|
||||
#define ActRcvFilDocInsCla (ActChgInsSta+ 64)
|
||||
#define ActExpAdmDocIns (ActChgInsSta+ 65)
|
||||
#define ActConAdmDocIns (ActChgInsSta+ 66)
|
||||
#define ActZIPAdmDocIns (ActChgInsSta+ 67)
|
||||
#define ActShoDocIns (ActChgInsSta+ 68)
|
||||
#define ActHidDocIns (ActChgInsSta+ 69)
|
||||
#define ActReqDatAdmDocIns (ActChgInsSta+ 70)
|
||||
#define ActChgDatAdmDocIns (ActChgInsSta+ 71)
|
||||
#define ActDowAdmDocIns (ActChgInsSta+ 72)
|
||||
#define ActChgToSeeDocIns (ActChgInsSta+ 45)
|
||||
#define ActSeeDocIns (ActChgInsSta+ 46)
|
||||
#define ActExpSeeDocIns (ActChgInsSta+ 47)
|
||||
#define ActConSeeDocIns (ActChgInsSta+ 48)
|
||||
#define ActZIPSeeDocIns (ActChgInsSta+ 49)
|
||||
#define ActReqDatSeeDocIns (ActChgInsSta+ 50)
|
||||
#define ActDowSeeDocIns (ActChgInsSta+ 51)
|
||||
#define ActChgToAdmDocIns (ActChgInsSta+ 52)
|
||||
#define ActAdmDocIns (ActChgInsSta+ 53)
|
||||
#define ActReqRemFilDocIns (ActChgInsSta+ 54)
|
||||
#define ActRemFilDocIns (ActChgInsSta+ 55)
|
||||
#define ActRemFolDocIns (ActChgInsSta+ 56)
|
||||
#define ActCopDocIns (ActChgInsSta+ 57)
|
||||
#define ActPasDocIns (ActChgInsSta+ 58)
|
||||
#define ActRemTreDocIns (ActChgInsSta+ 59)
|
||||
#define ActFrmCreDocIns (ActChgInsSta+ 60)
|
||||
#define ActCreFolDocIns (ActChgInsSta+ 61)
|
||||
#define ActCreLnkDocIns (ActChgInsSta+ 62)
|
||||
#define ActRenFolDocIns (ActChgInsSta+ 63)
|
||||
#define ActRcvFilDocInsDZ (ActChgInsSta+ 64)
|
||||
#define ActRcvFilDocInsCla (ActChgInsSta+ 65)
|
||||
#define ActExpAdmDocIns (ActChgInsSta+ 66)
|
||||
#define ActConAdmDocIns (ActChgInsSta+ 67)
|
||||
#define ActZIPAdmDocIns (ActChgInsSta+ 68)
|
||||
#define ActShoDocIns (ActChgInsSta+ 69)
|
||||
#define ActHidDocIns (ActChgInsSta+ 70)
|
||||
#define ActReqDatAdmDocIns (ActChgInsSta+ 71)
|
||||
#define ActChgDatAdmDocIns (ActChgInsSta+ 72)
|
||||
#define ActDowAdmDocIns (ActChgInsSta+ 73)
|
||||
|
||||
#define ActReqRemFilShaIns (ActChgInsSta+ 73)
|
||||
#define ActRemFilShaIns (ActChgInsSta+ 74)
|
||||
#define ActRemFolShaIns (ActChgInsSta+ 75)
|
||||
#define ActCopShaIns (ActChgInsSta+ 76)
|
||||
#define ActPasShaIns (ActChgInsSta+ 77)
|
||||
#define ActRemTreShaIns (ActChgInsSta+ 78)
|
||||
#define ActFrmCreShaIns (ActChgInsSta+ 79)
|
||||
#define ActCreFolShaIns (ActChgInsSta+ 80)
|
||||
#define ActCreLnkShaIns (ActChgInsSta+ 81)
|
||||
#define ActRenFolShaIns (ActChgInsSta+ 82)
|
||||
#define ActRcvFilShaInsDZ (ActChgInsSta+ 83)
|
||||
#define ActRcvFilShaInsCla (ActChgInsSta+ 84)
|
||||
#define ActExpShaIns (ActChgInsSta+ 85)
|
||||
#define ActConShaIns (ActChgInsSta+ 86)
|
||||
#define ActZIPShaIns (ActChgInsSta+ 87)
|
||||
#define ActReqDatShaIns (ActChgInsSta+ 88)
|
||||
#define ActChgDatShaIns (ActChgInsSta+ 89)
|
||||
#define ActDowShaIns (ActChgInsSta+ 90)
|
||||
#define ActReqRemFilShaIns (ActChgInsSta+ 74)
|
||||
#define ActRemFilShaIns (ActChgInsSta+ 75)
|
||||
#define ActRemFolShaIns (ActChgInsSta+ 76)
|
||||
#define ActCopShaIns (ActChgInsSta+ 77)
|
||||
#define ActPasShaIns (ActChgInsSta+ 78)
|
||||
#define ActRemTreShaIns (ActChgInsSta+ 79)
|
||||
#define ActFrmCreShaIns (ActChgInsSta+ 80)
|
||||
#define ActCreFolShaIns (ActChgInsSta+ 81)
|
||||
#define ActCreLnkShaIns (ActChgInsSta+ 82)
|
||||
#define ActRenFolShaIns (ActChgInsSta+ 83)
|
||||
#define ActRcvFilShaInsDZ (ActChgInsSta+ 84)
|
||||
#define ActRcvFilShaInsCla (ActChgInsSta+ 85)
|
||||
#define ActExpShaIns (ActChgInsSta+ 86)
|
||||
#define ActConShaIns (ActChgInsSta+ 87)
|
||||
#define ActZIPShaIns (ActChgInsSta+ 88)
|
||||
#define ActReqDatShaIns (ActChgInsSta+ 89)
|
||||
#define ActChgDatShaIns (ActChgInsSta+ 90)
|
||||
#define ActDowShaIns (ActChgInsSta+ 91)
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************************* Centre tab ********************************/
|
||||
|
|
|
@ -150,13 +150,17 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.30.2 (2016-10-21)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.31 (2016-10-22)"
|
||||
#define CSS_FILE "swad16.25.css"
|
||||
#define JS_FILE "swad15.238.1.js"
|
||||
|
||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
||||
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
|
||||
/*
|
||||
Version 16.31: Oct 22, 2016 New form in institution configuration to change full name. (205097 lines)
|
||||
1 change necessary in database:
|
||||
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1591','es','N','Cambiar nombre completo ins.');
|
||||
|
||||
Version 16.30.2: Oct 21, 2016 Code refactoring related to actions. (205077 lines)
|
||||
Version 16.30.1: Oct 20, 2016 Code refactoring related to tabs. (205077 lines)
|
||||
Version 16.30: Oct 20, 2016 Removed country in edition of institutions. (205058 lines)
|
||||
|
|
|
@ -76,8 +76,9 @@ static bool Ins_CheckIfICanEdit (struct Institution *Ins);
|
|||
static Ins_StatusTxt_t Ins_GetStatusTxtFromStatusBits (Ins_Status_t Status);
|
||||
static Ins_Status_t Ins_GetStatusBitsFromStatusTxt (Ins_StatusTxt_t StatusTxt);
|
||||
static void Ins_PutParamOtherInsCod (long InsCod);
|
||||
static bool Ins_RenameInstitution (struct Institution *Ins,Cns_ShortOrFullName_t ShortOrFullName);
|
||||
static void Ins_RenameInstitution (struct Institution *Ins,Cns_ShortOrFullName_t ShortOrFullName);
|
||||
static bool Ins_CheckIfInsNameExistsInCty (const char *FieldName,const char *Name,long InsCod,long CtyCod);
|
||||
static void Ins_UpdateInsNameDB (long InsCod,const char *FieldName,const char *NewInsName);
|
||||
static void Ins_UpdateInsCtyDB (long InsCod,long CtyCod);
|
||||
static void Ins_PutButtonToGoToIns (struct Institution *Ins);
|
||||
|
||||
|
@ -354,15 +355,22 @@ static void Ins_Configuration (bool PrintView)
|
|||
"<td class=\"DAT_N LEFT_MIDDLE\">",
|
||||
The_ClassForm[Gbl.Prefs.Theme],
|
||||
Txt_Institution);
|
||||
if (PutLink)
|
||||
fprintf (Gbl.F.Out,"<a href=\"%s\" target=\"_blank\""
|
||||
" class=\"DAT_N\" title=\"%s\">",
|
||||
Gbl.CurrentIns.Ins.WWW,
|
||||
if (!PrintView &&
|
||||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) // Only system admins can edit institution full name
|
||||
{
|
||||
Act_FormStart (ActRenInsFulCfg);
|
||||
fprintf (Gbl.F.Out,"<input type=\"text\" name=\"FullName\""
|
||||
" maxlength=\"%u\" value=\"%s\""
|
||||
" class=\"INPUT_FULL_NAME\""
|
||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||
Ins_MAX_LENGTH_INSTITUTION_FULL_NAME,
|
||||
Gbl.CurrentIns.Ins.FullName,
|
||||
Gbl.Form.Id);
|
||||
Act_FormEnd ();
|
||||
}
|
||||
else // I can not edit institution full name
|
||||
fprintf (Gbl.F.Out,"%s",
|
||||
Gbl.CurrentIns.Ins.FullName);
|
||||
fprintf (Gbl.F.Out,"%s",
|
||||
Gbl.CurrentIns.Ins.FullName);
|
||||
if (PutLink)
|
||||
fprintf (Gbl.F.Out,"</a>");
|
||||
fprintf (Gbl.F.Out,"</td>"
|
||||
"</tr>");
|
||||
|
||||
|
@ -1002,7 +1010,7 @@ void Ins_GetListInstitutions (long CtyCod,Ins_GetExtraData_t GetExtraData)
|
|||
bool Ins_GetDataOfInstitutionByCod (struct Institution *Ins,
|
||||
Ins_GetExtraData_t GetExtraData)
|
||||
{
|
||||
char Query[1024];
|
||||
char Query[256];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
bool InsFound;
|
||||
|
@ -1090,7 +1098,7 @@ bool Ins_GetDataOfInstitutionByCod (struct Institution *Ins,
|
|||
|
||||
void Ins_GetShortNameOfInstitutionByCod (struct Institution *Ins)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[128];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
|
||||
|
@ -1098,8 +1106,7 @@ void Ins_GetShortNameOfInstitutionByCod (struct Institution *Ins)
|
|||
if (Ins->InsCod > 0)
|
||||
{
|
||||
/***** Get the short name of an institution from database *****/
|
||||
sprintf (Query,"SELECT ShortName FROM institutions"
|
||||
" WHERE InsCod ='%ld'",
|
||||
sprintf (Query,"SELECT ShortName FROM institutions WHERE InsCod ='%ld'",
|
||||
Ins->InsCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get the short name of an institution") == 1)
|
||||
{
|
||||
|
@ -1135,7 +1142,7 @@ void Ins_FreeListInstitutions (void)
|
|||
void Ins_WriteSelectorOfInstitution (void)
|
||||
{
|
||||
extern const char *Txt_Institution;
|
||||
char Query[512];
|
||||
char Query[256];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned NumInss;
|
||||
|
@ -1286,7 +1293,8 @@ static void Ins_ListInstitutionsForEdition (void)
|
|||
" maxlength=\"%u\" value=\"%s\""
|
||||
" class=\"INPUT_FULL_NAME\""
|
||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||
Ins_MAX_LENGTH_INSTITUTION_FULL_NAME,Ins->FullName,
|
||||
Ins_MAX_LENGTH_INSTITUTION_FULL_NAME,
|
||||
Ins->FullName,
|
||||
Gbl.Form.Id);
|
||||
Act_FormEnd ();
|
||||
}
|
||||
|
@ -1476,7 +1484,7 @@ void Ins_RemoveInstitution (void)
|
|||
{
|
||||
extern const char *Txt_To_remove_an_institution_you_must_first_remove_all_centres_and_users_in_the_institution;
|
||||
extern const char *Txt_Institution_X_removed;
|
||||
char Query[512];
|
||||
char Query[128];
|
||||
struct Institution Ins;
|
||||
char PathIns[PATH_MAX+1];
|
||||
|
||||
|
@ -1527,13 +1535,11 @@ void Ins_RemoveInstitution (void)
|
|||
|
||||
void Ins_RenameInsShort (void)
|
||||
{
|
||||
struct Institution *Ins;
|
||||
/* Get the code of the institution */
|
||||
if ((Gbl.Inss.EditingIns.InsCod = Ins_GetParamOtherInsCod ()) < 0)
|
||||
Lay_ShowErrorAndExit ("Code of institution is missing.");
|
||||
|
||||
Ins = &Gbl.Inss.EditingIns;
|
||||
|
||||
if (Ins_RenameInstitution (Ins,Cns_SHORT_NAME))
|
||||
if (Ins->InsCod == Gbl.CurrentIns.Ins.InsCod) // If renaming current institution...
|
||||
strcpy (Gbl.CurrentIns.Ins.ShortName,Ins->ShortName); // Overwrite current institution name in order to show correctly in page title and heading
|
||||
Ins_RenameInstitution (&Gbl.Inss.EditingIns,Cns_SHORT_NAME);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1542,34 +1548,33 @@ void Ins_RenameInsShort (void)
|
|||
|
||||
void Ins_RenameInsFull (void)
|
||||
{
|
||||
struct Institution *Ins;
|
||||
/* Get the code of the institution */
|
||||
if ((Gbl.Inss.EditingIns.InsCod = Ins_GetParamOtherInsCod ()) < 0)
|
||||
Lay_ShowErrorAndExit ("Code of institution is missing.");
|
||||
|
||||
Ins = &Gbl.Inss.EditingIns;
|
||||
Ins_RenameInstitution (&Gbl.Inss.EditingIns,Cns_FULL_NAME);
|
||||
}
|
||||
|
||||
if (Ins_RenameInstitution (Ins,Cns_FULL_NAME))
|
||||
if (Ins->InsCod == Gbl.CurrentIns.Ins.InsCod) // If renaming current institution...
|
||||
strcpy (Gbl.CurrentIns.Ins.FullName,Ins->FullName); // Overwrite current institution name in order to show correctly in page title and heading
|
||||
void Ins_RenameInsFullInConfig (void)
|
||||
{
|
||||
Ins_RenameInstitution (&Gbl.CurrentIns.Ins,Cns_FULL_NAME);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************** Change the name of an institution **********************/
|
||||
/*****************************************************************************/
|
||||
// Returns true if the institution is renamed
|
||||
// Returns false if the institution is not renamed
|
||||
|
||||
static bool Ins_RenameInstitution (struct Institution *Ins,Cns_ShortOrFullName_t ShortOrFullName)
|
||||
static void Ins_RenameInstitution (struct Institution *Ins,Cns_ShortOrFullName_t ShortOrFullName)
|
||||
{
|
||||
extern const char *Txt_You_can_not_leave_the_name_of_the_institution_X_empty;
|
||||
extern const char *Txt_The_institution_X_already_exists;
|
||||
extern const char *Txt_The_institution_X_has_been_renamed_as_Y;
|
||||
extern const char *Txt_The_name_of_the_institution_X_has_not_changed;
|
||||
char Query[512];
|
||||
const char *ParamName = NULL; // Initialized to avoid warning
|
||||
const char *FieldName = NULL; // Initialized to avoid warning
|
||||
unsigned MaxLength = 0; // Initialized to avoid warning
|
||||
char *CurrentInsName = NULL; // Initialized to avoid warning
|
||||
char NewInsName[Ins_MAX_LENGTH_INSTITUTION_FULL_NAME+1];
|
||||
bool InstitutionHasBeenRenamed = false;
|
||||
|
||||
switch (ShortOrFullName)
|
||||
{
|
||||
|
@ -1587,12 +1592,7 @@ static bool Ins_RenameInstitution (struct Institution *Ins,Cns_ShortOrFullName_t
|
|||
break;
|
||||
}
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get the code of the institution */
|
||||
if ((Ins->InsCod = Ins_GetParamOtherInsCod ()) < 0)
|
||||
Lay_ShowErrorAndExit ("Code of institution is missing.");
|
||||
|
||||
/* Get the new name for the institution */
|
||||
/***** Get the new name for the institution from form *****/
|
||||
Par_GetParToText (ParamName,NewInsName,MaxLength);
|
||||
|
||||
/***** Get from the database the old names of the institution *****/
|
||||
|
@ -1620,9 +1620,7 @@ static bool Ins_RenameInstitution (struct Institution *Ins,Cns_ShortOrFullName_t
|
|||
else
|
||||
{
|
||||
/* Update the table changing old name by new name */
|
||||
sprintf (Query,"UPDATE institutions SET %s='%s' WHERE InsCod='%ld'",
|
||||
FieldName,NewInsName,Ins->InsCod);
|
||||
DB_QueryUPDATE (Query,"can not update the name of an institution");
|
||||
Ins_UpdateInsNameDB (Ins->InsCod,FieldName,NewInsName);
|
||||
|
||||
/* Write message to show the change made */
|
||||
sprintf (Gbl.Message,Txt_The_institution_X_has_been_renamed_as_Y,
|
||||
|
@ -1631,16 +1629,12 @@ static bool Ins_RenameInstitution (struct Institution *Ins,Cns_ShortOrFullName_t
|
|||
/* Change current institution name in order to display it properly */
|
||||
strncpy (CurrentInsName,NewInsName,MaxLength);
|
||||
CurrentInsName[MaxLength] = '\0';
|
||||
|
||||
InstitutionHasBeenRenamed = true;
|
||||
}
|
||||
}
|
||||
else // The same name
|
||||
sprintf (Gbl.Message,Txt_The_name_of_the_institution_X_has_not_changed,
|
||||
CurrentInsName);
|
||||
}
|
||||
|
||||
return InstitutionHasBeenRenamed;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1649,7 +1643,7 @@ static bool Ins_RenameInstitution (struct Institution *Ins,Cns_ShortOrFullName_t
|
|||
|
||||
static bool Ins_CheckIfInsNameExistsInCty (const char *FieldName,const char *Name,long InsCod,long CtyCod)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[256+Ins_MAX_LENGTH_INSTITUTION_FULL_NAME];
|
||||
|
||||
/***** Get number of institutions in current country with a name from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM institutions"
|
||||
|
@ -1658,6 +1652,20 @@ static bool Ins_CheckIfInsNameExistsInCty (const char *FieldName,const char *Nam
|
|||
return (DB_QueryCOUNT (Query,"can not check if the name of an institution already existed") != 0);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************ Update institution name in table of institutions ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Ins_UpdateInsNameDB (long InsCod,const char *FieldName,const char *NewInsName)
|
||||
{
|
||||
char Query[128+Ins_MAX_LENGTH_INSTITUTION_FULL_NAME];
|
||||
|
||||
/***** Update institution changing old name by new name */
|
||||
sprintf (Query,"UPDATE institutions SET %s='%s' WHERE InsCod='%ld'",
|
||||
FieldName,NewInsName,InsCod);
|
||||
DB_QueryUPDATE (Query,"can not update the name of an institution");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************* Change the country of a institution *********************/
|
||||
/*****************************************************************************/
|
||||
|
@ -2151,7 +2159,10 @@ static void Ins_RecFormRequestOrCreateIns (unsigned Status)
|
|||
static void Ins_CreateInstitution (struct Institution *Ins,unsigned Status)
|
||||
{
|
||||
extern const char *Txt_Created_new_institution_X;
|
||||
char Query[2048];
|
||||
char Query[512+
|
||||
Ins_MAX_LENGTH_INSTITUTION_SHORT_NAME+
|
||||
Ins_MAX_LENGTH_INSTITUTION_FULL_NAME+
|
||||
Cns_MAX_LENGTH_WWW];
|
||||
|
||||
/***** Create a new institution *****/
|
||||
sprintf (Query,"INSERT INTO institutions (CtyCod,Status,RequesterUsrCod,"
|
||||
|
@ -2179,7 +2190,7 @@ static void Ins_CreateInstitution (struct Institution *Ins,unsigned Status)
|
|||
|
||||
unsigned Ins_GetNumInssTotal (void)
|
||||
{
|
||||
char Query[256];
|
||||
char Query[128];
|
||||
|
||||
/***** Get total number of degrees from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM institutions");
|
||||
|
@ -2192,7 +2203,7 @@ unsigned Ins_GetNumInssTotal (void)
|
|||
|
||||
unsigned Ins_GetNumInssInCty (long CtyCod)
|
||||
{
|
||||
char Query[256];
|
||||
char Query[128];
|
||||
|
||||
/***** Get number of degrees of a place from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM institutions"
|
||||
|
|
|
@ -112,6 +112,7 @@ long Ins_GetParamOtherInsCod (void);
|
|||
void Ins_RemoveInstitution (void);
|
||||
void Ins_RenameInsShort (void);
|
||||
void Ins_RenameInsFull (void);
|
||||
void Ins_RenameInsFullInConfig (void);
|
||||
void Ins_ChangeInsCtyInConfig (void);
|
||||
void Ins_ContEditAfterChgInsInConfig (void);
|
||||
void Ins_ChangeInsWWW (void);
|
||||
|
|
Loading…
Reference in New Issue