parent
f7d0d82505
commit
2d59619df5
@ -716,15 +716,27 @@ if (empty($reshook) && $action == 'update') {
|
||||
$datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser');
|
||||
}
|
||||
|
||||
if ($object->elementtype == 'ticket') {
|
||||
if ($object->elementtype == 'ticket') { // code should be TICKET_MSG, TICKET_MSG_PRIVATE, TICKET_MSG_SENTBYMAIL, TICKET_MSG_PRIVATE_SENTBYMAIL
|
||||
if ($private) {
|
||||
$object->type_code = 'TICKET_MSG_PRIVATE';
|
||||
if ($object->code == 'TICKET_MSG') {
|
||||
$object->code = 'TICKET_MSG_PRIVATE';
|
||||
}
|
||||
if ($object->code == 'TICKET_MSG_SENTBYMAIL') {
|
||||
$object->code = 'TICKET_MSG_PRIVATE_SENTBYMAIL';
|
||||
}
|
||||
} else {
|
||||
$object->type_id = dol_getIdFromCode($db, 'AC_EMAIL', 'c_actioncomm');
|
||||
if ($object->code == 'TICKET_MSG_PRIVATE') {
|
||||
$object->code = 'TICKET_MSG';
|
||||
}
|
||||
if ($object->code == 'TICKET_MSG_PRIVATE_SENTBYMAIL') {
|
||||
$object->code = 'TICKET_MSG_SENTBYMAIL';
|
||||
}
|
||||
}
|
||||
// type_id and type_code is not modified
|
||||
} else {
|
||||
$object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm');
|
||||
}
|
||||
|
||||
$object->label = GETPOST("label", "alphanohtml");
|
||||
$object->datep = $datep;
|
||||
$object->datef = $datef;
|
||||
@ -1315,11 +1327,6 @@ if ($action == 'create') {
|
||||
|
||||
// Date start
|
||||
print '<tr><td class="nowrap">';
|
||||
/*
|
||||
print '<span class="fieldrequired">'.$langs->trans("DateActionStart").'</span>';
|
||||
print ' - ';
|
||||
print '<span id="dateend"'.(GETPOST("actioncode", 'aZ09') == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'</span>';
|
||||
*/
|
||||
print '</td><td>';
|
||||
if (GETPOST("afaire") == 1) {
|
||||
print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel'); // Empty value not allowed for start date and hours if "todo"
|
||||
@ -1743,7 +1750,9 @@ if ($id > 0) {
|
||||
|
||||
// Private
|
||||
if ($object->elementtype == 'ticket') {
|
||||
print '<tr><td>'.$langs->trans("PrivateEventMessage").'</td><td colspan="3"><input type="checkbox" id="private" name="private" '.(preg_match('/^TICKET_MSG_PRIVATE/', $object->code) ? ' checked' : '').'></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("MarkMessageAsPrivate");
|
||||
print ' '.$form->textwithpicto('', $langs->trans("TicketMessagePrivateHelp"), 1, 'help');
|
||||
print '</td><td colspan="3"><input type="checkbox" id="private" name="private" '.(preg_match('/^TICKET_MSG_PRIVATE/', $object->code) ? ' checked' : '').'></td></tr>';
|
||||
}
|
||||
|
||||
// Title
|
||||
@ -2207,18 +2216,13 @@ if ($id > 0) {
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
// Type
|
||||
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $object->elementtype != 'ticket') {
|
||||
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td>';
|
||||
print $object->getTypePicto();
|
||||
print $langs->trans("Action".$object->type_code);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Private
|
||||
if ($object->elementtype == 'ticket') {
|
||||
print '<tr><td class="titlefield">'.$langs->trans("PrivateEventMessage").'</td><td>'.yn(preg_match('/^TICKET_MSG_PRIVATE/', $object->code) ? 1 : 0, 3).'</td></tr>';
|
||||
}
|
||||
|
||||
// Full day event
|
||||
print '<tr><td class="titlefield">'.$langs->trans("EventOnFullDay").'</td><td>'.yn($object->fulldayevent ? 1 : 0, 3).'</td></tr>';
|
||||
|
||||
|
||||
@ -1162,12 +1162,8 @@ class ActionComm extends CommonObject
|
||||
$userownerid = ($this->userownerid ? $this->userownerid : 0);
|
||||
$userdoneid = ($this->userdoneid ? $this->userdoneid : 0);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm ";
|
||||
$sql .= " SET percent = '".$this->db->escape($this->percentage)."'";
|
||||
// If a type_id is set, we must also have the type_code set
|
||||
if ($this->type_id > 0) {
|
||||
$sql .= ", fk_action = ".(int) $this->type_id;
|
||||
if (empty($this->type_code)) {
|
||||
$cactioncomm = new CActionComm($this->db);
|
||||
$result = $cactioncomm->fetch($this->type_id);
|
||||
@ -1176,7 +1172,18 @@ class ActionComm extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
$sql .= ", code = " . (isset($this->type_code)? "'".$this->db->escape($this->type_code) . "'":"null");
|
||||
|
||||
$code = $this->code;
|
||||
if (empty($code)) {
|
||||
$code = $this->type_code;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm";
|
||||
$sql .= " SET percent = '".$this->db->escape($this->percentage)."'";
|
||||
$sql .= ", fk_action = ".(int) $this->type_id;
|
||||
$sql .= ", code = " . ($code ? "'".$this->db->escape($code)."'" : "null");
|
||||
$sql .= ", label = ".($this->label ? "'".$this->db->escape($this->label)."'" : "null");
|
||||
$sql .= ", datep = ".(strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : 'null');
|
||||
$sql .= ", datep2 = ".(strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : 'null');
|
||||
@ -1207,7 +1214,7 @@ class ActionComm extends CommonObject
|
||||
if (!empty($this->status)) {
|
||||
$sql .= ", status=".($this->status ? (int) $this->status : 0);
|
||||
}
|
||||
$sql .= " WHERE id=".$this->id;
|
||||
$sql .= " WHERE id=".((int) $this->id);
|
||||
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
if ($this->db->query($sql)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user