Fehlermeldung nach Update auf Drupal 10
am 03.09.2023 - 13:18 Uhr in
Hallo zusammen,
Ich habe ein Update meiner Drupal-Seite durchgeführt.
Ich erhalte in der Konsole nachdem ich auf Terminbuchung klicke in der Konsole einen Fehler. Der Termin wird zwar gebucht aber die Seite bleibt wie im Bild im Anhang.
Bitte helft mir :)
Was könnte das Problem bei dieser Funktion sein ?
public function saveappointmentuser(){
@$user_current = \Drupal::currentUser()->id();
@$user_info_current = \Drupal\user\Entity\User::load(\Drupal::currentUser()->id());
$userID_current = $user_info_current->uid->value;
$query = \Drupal::entityQuery('node');
$query->accessCheck(TRUE);
$query->condition('type', array('calendar_main'), 'IN');
$query->condition('status', 1);
$query->condition('uid', intval($_POST['owner']));
$query->sort('nid', 'DESC');
$entity_ids = $query->execute();
$entity_ids = reset($entity_ids);
if(isset($_POST['mykalendarpage']) && intval($_POST['mykalendarpage']) == 1){
$name_appointment = 'Termin '.$this->counterappointments($entity_ids);
}elseif(isset($_POST['mycreatepage']) && intval($_POST['mycreatepage']) == 1){
$name_appointment = 'Termin '.$this->counterappointments($entity_ids);
}else{
$name_appointment = 'Buchung '.$this->counterappointments($entity_ids);
}
$appointment_data = array();
$appointment_data['type'] = 'calendar_entries';
$appointment_data['uid'] = intval($userID_current);
$appointment_data['title'] = $name_appointment;
$appointment_data['body'] = $_POST['text'];
$appointment_data['field_calendar_selected_date'] = $_POST['date_format'];
$appointment_data['field_calendar_selected_hour'] = $_POST['hour'];
$appointment_data['field_calendar_id_assoc'] = intval($entity_ids);
$appointment_data['field_calendar_entry_key'] = $_POST['date_format'].'>'.$_POST['hour'].'>'.$entity_ids;
$appointment_data['field_calendar_entry_type'] = $_POST['type'];
$appointment_data['status'] = 1;
#$created_appointment = entity_create('node', $appointment_data);
#$created_appointment->save();
$created_appointment = \Drupal::entityTypeManager()->getStorage('node')->create($appointment_data);
$created_appointment->save();
$appointment_id = $created_appointment->uid->value;
$load_calendar = Node::load(intval($entity_ids));
$array_apppintments = array();
foreach ($load_calendar->get('field_calendar_entry_assoc')->getValue() as $key => $value) {
$appointmentload = Node::load(intval($value['target_id']));
if(!is_object($appointmentload)){
}else{
$array_apppintments[] = $value['target_id'];
}
}
$load_calendar->field_calendar_entry_assoc = $array_apppintments;
$load_calendar->save();
$load_calendar = Node::load(intval($entity_ids));
$appointment_list_data = $load_calendar->get('field_calendar_entry_assoc')->getValue();
if (empty($appointment_list_data)) {
$load_calendar->field_calendar_entry_assoc[0] = $appointment_id;
$load_calendar->save();
} elseif(!empty($appointment_list_data)) {
$appointment_count = count($appointment_list_data);
$load_calendar->field_calendar_entry_assoc[$appointment_count] = $appointment_id;
$load_calendar->save();
}
if(intval($userID_current) != intval($_POST['owner'])){
//email send
$custom_mails = new CemailController();
$current_user = \Drupal\user\Entity\User::load($userID_current);
$owner_kalendar = \Drupal\user\Entity\User::load(intval($_POST['owner']));
$custom_mails->userbookedmail($current_user);
$custom_mails->teacherbookedmail($owner_kalendar);
//email send
//create chat
//chat validation
$query = \Drupal::entityQuery('node');
$query->accessCheck(TRUE);
$query->condition('type', array('chat_content'), 'IN');
$query->condition('status', 1);
$query->condition('field_chat_user_from', array($userID_current),"IN");
$query->condition('field_chat_user_to', array($_POST['owner']),"IN");
$query->sort('nid', 'DESC');
$entity_ids = $query->execute();
$query_second = \Drupal::entityQuery('node');
$query_second->accessCheck(TRUE);
$query_second->condition('type', array('chat_content'), 'IN');
$query_second->condition('status', 1);
$query_second->condition('field_chat_user_from', array($_POST['owner']),"IN");
$query_second->condition('field_chat_user_to', array($userID_current),"IN");
$query_second->sort('nid', 'DESC');
$entity_ids_second = $query_second->execute();
//chat validation
if(!empty($entity_ids)){
//create message
$subject = 'User Comment ID '.htmlspecialchars($userID_current, ENT_QUOTES, 'UTF-8');
$chatmessage = '
'.htmlspecialchars($_POST['text'], ENT_QUOTES, 'UTF-8').'
';
$values = [
'entity_type' => 'node',
'entity_id' => end($entity_ids),
'field_name' => 'comment',
'uid' => $userID_current,
'comment_type' => 'comment',
'subject' => $subject,
'comment_body' => strip_tags($chatmessage),
'status' => 1
];
$comment = Comment::create($values);
$comment->save();
//create message
/*echo $GLOBALS['base_url'].'/partner/profile/chat/'.$userID_current.'#'.end($entity_ids);
die();*/
$custom_url = $GLOBALS['base_url'].'/buchungerfolgreich';
#drupal_set_message(t("Deine Buchung wurde erfolgreich durchgeführt."), 'status');
echo $custom_url;
}elseif(!empty($entity_ids_second)){
//create message
$subject = 'User Comment ID '.htmlspecialchars($userID_current, ENT_QUOTES, 'UTF-8');
$chatmessage = '
'.htmlspecialchars($_POST['text'], ENT_QUOTES, 'UTF-8').'
';
$values = [
'entity_type' => 'node',
'entity_id' => end($entity_ids_second),
'field_name' => 'comment',
'uid' => $userID_current,
'comment_type' => 'comment',
'subject' => $subject,
'comment_body' => strip_tags($chatmessage),
'status' => 1
];
$comment = Comment::create($values);
$comment->save();
//create message
/* echo $GLOBALS['base_url'].'/partner/profile/chat/'.$userID_current.'#'.end($entity_ids_second);
die();*/
$custom_url = $GLOBALS['base_url'].'/buchungerfolgreich';
#drupal_set_message(t("Deine Buchung wurde erfolgreich durchgeführt."), 'status');
echo $custom_url;
}else{
$chatcreation = array();
$chatcreation['type'] = 'chat_content';
$chatcreation['uid'] = intval($userID_current);
$chatcreation['title'] = "Chat between: ID-".$userID_current." and ID-".$_POST['owner'];
$chatcreation['body'] = "Chat between: ID-".$userID_current." and ID-".$_POST['owner'];
$chatcreation['field_chat_user_from'] = $userID_current;
$chatcreation['field_chat_user_to'] = $_POST['owner'];
$chatcreation['status'] = 1;
$created_chat = entity_create('node', $chatcreation);
$created_chat->save();
$chat_id = $created_chat->nid->value;
//create message
$subject = 'User Comment ID '.htmlspecialchars($userID_current, ENT_QUOTES, 'UTF-8');
$chatmessage = '
'.htmlspecialchars($_POST['text'], ENT_QUOTES, 'UTF-8').'
';
$values = [
'entity_type' => 'node',
'entity_id' => $chat_id,
'field_name' => 'comment',
'uid' => $userID_current,
'comment_type' => 'comment',
'subject' => $subject,
'comment_body' => strip_tags($chatmessage),
'status' => 1
];
$comment = Comment::create($values);
$comment->save();
//create message
}
//create chat
$custom_url = $GLOBALS['base_url'].'/buchungerfolgreich';
#drupal_set_message(t("Deine Buchung wurde erfolgreich durchgeführt."), 'status');
echo $custom_url;
}else{
echo 'ok';
}
die();
}
public function saveappointment(){
@$user_current = \Drupal::currentUser()->id();
@$user_info_current = \Drupal\user\Entity\User::load(\Drupal::currentUser()->id());
$userID_current = $user_info_current->uid->value;
$query = \Drupal::entityQuery('node');
$query->accessCheck(TRUE);
$query->condition('type', array('calendar_main'), 'IN');
$query->condition('status', 1);
$query->condition('uid', intval($_POST['owner']));
$query->sort('nid', 'DESC');
$entity_ids = $query->execute();
$entity_ids = reset($entity_ids);
if(isset($_POST['mykalendarpage']) && intval($_POST['mykalendarpage']) == 1){
$name_appointment = 'Termin '.$this->counterappointments($entity_ids);
}else{
$name_appointment = 'Buchung '.$this->counterappointments($entity_ids);
}
$appointment_data = array();
$appointment_data['type'] = 'calendar_entries';
$appointment_data['uid'] = intval($userID_current);
$appointment_data['title'] = $name_appointment;
$appointment_data['body'] = $_POST['text'];
$appointment_data['field_calendar_selected_date'] = $_POST['date_format'];
$appointment_data['field_calendar_selected_hour'] = $_POST['hour'];
$appointment_data['field_calendar_id_assoc'] = intval($entity_ids);
$appointment_data['field_calendar_entry_key'] = $_POST['date_format'].'>'.$_POST['hour'].'>'.$entity_ids;
$appointment_data['field_calendar_entry_type'] = $_POST['type'];
$appointment_data['status'] = 1;
$created_appointment = entity_create('node', $appointment_data);
$created_appointment->save();
$appointment_id = $created_appointment->nid->value;
$load_calendar = Node::load(intval($entity_ids));
$array_apppintments = array();
foreach ($load_calendar->get('field_calendar_entry_assoc')->getValue() as $key => $value) {
$appointmentload = Node::load(intval($value['target_id']));
if(!is_object($appointmentload)){
}else{
$array_apppintments[] = $value['target_id'];
}
}
$load_calendar->field_calendar_entry_assoc = $array_apppintments;
$load_calendar->save();
$load_calendar = Node::load(intval($entity_ids));
$appointment_list_data = $load_calendar->get('field_calendar_entry_assoc')->getValue();
if (empty($appointment_list_data)) {
$load_calendar->field_calendar_entry_assoc[0] = $appointment_id;
$load_calendar->save();
} elseif(!empty($appointment_list_data)) {
$appointment_count = count($appointment_list_data);
$load_calendar->field_calendar_entry_assoc[$appointment_count] = $appointment_id;
$load_calendar->save();
}
if(intval($userID_current) != intval($_POST['owner'])){
//email send
$custom_mails = new CemailController();
$current_user = \Drupal\user\Entity\User::load($userID_current);
$owner_kalendar = \Drupal\user\Entity\User::load(intval($_POST['owner']));
$custom_mails->userbookedmail($current_user);
$custom_mails->teacherbookedmail($owner_kalendar);
//email send
//create chat
//chat validation
$query = \Drupal::entityQuery('node');
$query->accessCheck(TRUE);
$query->condition('type', array('chat_content'), 'IN');
$query->condition('status', 1);
$query->condition('field_chat_user_from', array($userID_current),"IN");
$query->condition('field_chat_user_to', array($_POST['owner']),"IN");
$query->sort('nid', 'DESC');
$entity_ids = $query->execute();
$query_second = \Drupal::entityQuery('node');
$query_second->accessCheck(TRUE);
$query_second->condition('type', array('chat_content'), 'IN');
$query_second->condition('status', 1);
$query_second->condition('field_chat_user_from', array($_POST['owner']),"IN");
$query_second->condition('field_chat_user_to', array($userID_current),"IN");
$query_second->sort('nid', 'DESC');
$entity_ids_second = $query_second->execute();
//chat validation
if(!empty($entity_ids)){
//create message
$subject = 'User Comment ID '.htmlspecialchars($userID_current, ENT_QUOTES, 'UTF-8');
$chatmessage = '
'.htmlspecialchars($_POST['text'], ENT_QUOTES, 'UTF-8').'
';
$values = [
'entity_type' => 'node',
'entity_id' => end($entity_ids),
'field_name' => 'comment',
'uid' => $userID_current,
'comment_type' => 'comment',
'subject' => $subject,
'comment_body' => strip_tags($chatmessage),
'status' => 1
];
$comment = Comment::create($values);
$comment->save();
//create message
echo $GLOBALS['base_url'].'/buchungerfolgreich';
die();
}elseif(!empty($entity_ids_second)){
//create message
$subject = 'User Comment ID '.htmlspecialchars($userID_current, ENT_QUOTES, 'UTF-8');
$chatmessage = '
'.htmlspecialchars($_POST['text'], ENT_QUOTES, 'UTF-8').'
';
$values = [
'entity_type' => 'node',
'entity_id' => end($entity_ids_second),
'field_name' => 'comment',
'uid' => $userID_current,
'comment_type' => 'comment',
'subject' => $subject,
'comment_body' => strip_tags($chatmessage),
'status' => 1
];
$comment = Comment::create($values);
$comment->save();
//create message
echo $GLOBALS['base_url'].'/buchungerfolgreich';
die();
}else{
$chatcreation = array();
$chatcreation['type'] = 'chat_content';
$chatcreation['uid'] = intval($userID_current);
$chatcreation['title'] = "Chat between: ID-".$userID_current." and ID-".$_POST['owner'];
$chatcreation['body'] = "Chat between: ID-".$userID_current." and ID-".$_POST['owner'];
$chatcreation['field_chat_user_from'] = $userID_current;
$chatcreation['field_chat_user_to'] = $_POST['owner'];
$chatcreation['status'] = 1;
#$created_chat = entity_create('node', $chatcreation);
#$created_chat->save();
\Drupal::entityTypeManager()->getStorage('node')->create($chatcreation);
$created_chat->save();
$chat_id = $created_chat->nid->value;
//create message
$subject = 'User Comment ID '.htmlspecialchars($userID_current, ENT_QUOTES, 'UTF-8');
$chatmessage = '
'.htmlspecialchars($_POST['text'], ENT_QUOTES, 'UTF-8').'
';
$values = [
'entity_type' => 'node',
'entity_id' => $chat_id,
'field_name' => 'comment',
'uid' => $userID_current,
'comment_type' => 'comment',
'subject' => $subject,
'comment_body' => strip_tags($chatmessage),
'status' => 1
];
$comment = Comment::create($values);
$comment->save();
//create message
}
//create chat
$custom_url = $GLOBALS['base_url'].'/buchungerfolgreich';
#+drupal_set_message(t("Der Termin wurde erfolgreich gebucht."), 'status');
echo $custom_url;
}else{
echo 'ok';
}
die();
}
public function x_week_range($date) {
$ts = strtotime($date);
if(date('D', $ts) === 'Mon'){
$start = (date('w', $ts) == 0) ? $ts : strtotime('monday', $ts);
}else{
$start = (date('w', $ts) == 0) ? $ts : strtotime('last monday', $ts);
}
return array(date('Y-m-d', $start),
date('Y-m-d', strtotime('next sunday', $start)));
}
Anhang | Größe |
---|---|
Bild_2023-09-03_141640656.png | 212.35 KB |
- Anmelden oder Registrieren um Kommentare zu schreiben
jQuery
am 04.09.2023 - 07:07 Uhr
Evtl. könnte der Fehler etwas mit jQuery zu tun haben. Das wurde ja mit dem Wechsel auf Drupal 10 aus dem Core entfernt. Du könntest versuchen jQuery als externe Bibliothek hinzuzufügen. Entweder mit einem Zusatzmodul oder manuell im Verzeichnis /libraries (Modul libraries muss aktiv sein).
Hallo, Vielen Dank für Ihre
am 04.09.2023 - 16:47 Uhr
Hallo,
Vielen Dank für Ihre Antwort. Könnten Sie das etwas genauer erklären ?
Bedeutet das, ich muss nur das Modul /libraries installieren ?
Vielen Dank und viele Grüße
Also die Terminbuchung
am 04.09.2023 - 17:21 Uhr
Also die Terminbuchung funktioniert ja. Es steht dann auch im Kalender. Nur die Seite bleibt so stehen. Es kommt keine Nachricht ‚erfolgreich gebucht‘. Generell funktionieren Nachrichten über den Messenger irgendwie nicht.
Hallo. Der Server liefert
am 04.09.2023 - 20:23 Uhr
Hallo. Der Server liefert nichts zurück für die Weiterverarbeitung und meldet laut Screenshot stattdessen den Serverfehler "500". Deswegen geht es vermutlich nicht weiter. Gibt es serverseitige Logs?
Wie genau sehe ich das wo
am 06.09.2023 - 19:07 Uhr
Wie genau sehe ich das wo serverseitige logs sind ?
Bitte um Hilfe
am 12.09.2023 - 17:24 Uhr
Möchte mir vielleicht jemand helfen ? Ich habs immernoch nicht hinbekommen.
Rubi_2021 schriebWie genau
am 13.09.2023 - 16:06 Uhr
Wie genau sehe ich das wo serverseitige logs sind ?
Die sind auf dem Server kalendra.net. Einmal unter Apache-Logs nachschauen. Ebenso unter PHP-Logs. Habe soeben die URL https://kalendra.net/saveappointmentsuser eingegeben und 404 bekommen. Die Route scheint es nicht zu geben.