func (VS *Server) addMessageReport(c *gin.Context) {
	idReport, b := VS.getIDParamFromURL(c, "id")
	if !b {
		return
	}
	rep := VS.getReportByID(c, idReport, "h_comunication", "addMessageReport", "rep := VS.getReportByID")
	if rep.IsClose {
		return
	}
	text, _ := VS.getStringFromHTML(c, "message", "Message")

	// We leave open the possibility that there is no audio or video
	photo, audio := "", ""
	p, _ := c.FormFile("photo")
	a, _ := c.FormFile("audio")
	id := bson.NewObjectId()
	if p != nil {
		photo, b = VS.getFileFromHTML(c, "photo", id.Hex(), basePath+"/local-resources/conversations/"+id.Hex()+"/")
		if !b {
			return
		}
	}
	if a != nil {
		audio, b = VS.getFileFromHTML(c, "audio", id.Hex(), basePath+"/local-resources/conversations/"+id.Hex()+"/")
		if !b {
			return
		}
	}
	msg := Message{
		ID:             id,
		IDConversation: idReport,
		Text:           text,
		Photo:          photo,
		Audio:          audio,
		Date:           getTime(),
		IDUser:         VS.getUserFomCookie(c, "h_comunication", "addMessageReport", "IDUser: VS.getUserFomCookie(").ID,
	}
	close := VS.getCheckBoxFromHTML(c, "closereport")
	if close {
		rep.IsClose = true
		VS.addElementToDatabaseWithRegisterFromCentral(c, rep, rep.ID, "h_comunication", "addMessageReport", "VS.addElementToDatabaseWithRegisterFromCentral")
	}
	VS.addElementToDatabaseWithRegisterFromCentral(c, msg, msg.ID, "h_comunication", "addMessageReport", "VS.addElementToDatabaseWithRegisterFromCentral")
	c.Redirect(http.StatusFound, "/comunication/see-report/"+idReport.Hex())
}
// This handler adds the message to the Report
This handler adds the message to the Report
// This handler adds the message to the Report
func (VS *Server) addMessageReport(c *gin.Context) {
	idReport, b := VS.getIDParamFromURL(c, "id")
	if !b {
		return
	}
	rep := VS.getReportByID(c, idReport, "h_comunication", "addMessageReport", "rep := VS.getReportByID")
	if rep.IsClose {
		return
	}
	text, _ := VS.getStringFromHTML(c, "message", "Message")
	photo, audio := "", ""
	p, _ := c.FormFile("photo")
	a, _ := c.FormFile("audio")
	id := bson.NewObjectId()
	if p != nil {
		photo, b = VS.getFileFromHTML(c, "photo", id.Hex(), basePath+"/local-resources/conversations/"+id.Hex()+"/")
		if !b {
			return
		}
	}
	if a != nil {
		audio, b = VS.getFileFromHTML(c, "audio", id.Hex(), basePath+"/local-resources/conversations/"+id.Hex()+"/")
		if !b {
			return
		}
	}
	msg := Message{
		ID:             id,
		IDConversation: idReport,
		Text:           text,
		Photo:          photo,
		Audio:          audio,
		Date:           getTime(),
		IDUser:         VS.getUserFomCookie(c, "h_comunication", "addMessageReport", "IDUser: VS.getUserFomCookie(").ID,
	}
	close := VS.getCheckBoxFromHTML(c, "closereport")
	if close {
		rep.IsClose = true
		VS.addElementToDatabaseWithRegisterFromCentral(c, rep, rep.ID, "h_comunication", "addMessageReport", "VS.addElementToDatabaseWithRegisterFromCentral")
	}
	VS.addElementToDatabaseWithRegisterFromCentral(c, msg, msg.ID, "h_comunication", "addMessageReport", "VS.addElementToDatabaseWithRegisterFromCentral")
	c.Redirect(http.StatusFound, "/comunication/see-report/"+idReport.Hex())
}
func ( VS * Server ) addMessageReport ( c * gin . Context ) { idReport , b := VS . getIDParamFromURL ( c , " " ) if ! b { return } rep := VS . getReportByID ( c , idReport , " " , " " , " " ) if rep . IsClose { return } text , _ := VS . getStringFromHTML ( c , " " , " " ) photo , audio := " " , " " p , _ := c . FormFile ( " " ) a , _ := c . FormFile ( " " ) id := bson . NewObjectId ( ) if p != nil { photo , b = VS . getFileFromHTML ( c , " " , id . Hex ( ) , basePath + " " + id . Hex ( ) + " " ) if ! b { return } } if a != nil { audio , b = VS . getFileFromHTML ( c , " " , id . Hex ( ) , basePath + " " + id . Hex ( ) + " " ) if ! b { return } } msg := Message { ID : id , IDConversation : idReport , Text : text , Photo : photo , Audio : audio , Date : getTime ( ) , IDUser : VS . getUserFomCookie ( c , " " , " " , " " ) . ID , } close := VS . getCheckBoxFromHTML ( c , " " ) if close { rep . IsClose = true VS . addElementToDatabaseWithRegisterFromCentral ( c , rep , rep . ID , " " , " " , " " ) } VS . addElementToDatabaseWithRegisterFromCentral ( c , msg , msg . ID , " " , " " , " " ) c . Redirect ( http . StatusFound , " " + idReport . Hex ( ) ) }
This handler adds the message to the Report
This handler adds the message to the Report
// We leave open the possibility that there is no audio or video