예제 #1
0
                    $err = $err . $tmp;
                }
            }
        } else {
            $err .= get_vocab("too_may_entrys") . "<P>";
            $hide_title = 1;
        }
    } else {
        $err .= mrbsCheckFree($room_id, $starttime, $endtime - 1, $ignore_id, 0);
    }
}
# end foreach rooms
if (empty($err)) {
    foreach ($rooms as $room_id) {
        if ($edit_type == "series") {
            $new_id = mrbsCreateRepeatingEntrys($starttime, $endtime, $rep_type, $rep_enddate, $rep_opt, $room_id, $create_by, $name, $type, $description, isset($rep_num_weeks) ? $rep_num_weeks : 0);
            // Send a mail to the Administrator
            if (MAIL_ADMIN_ON_BOOKINGS or MAIL_AREA_ADMIN_ON_BOOKINGS or MAIL_ROOM_ADMIN_ON_BOOKINGS or MAIL_BOOKER) {
                include_once "functions_mail.inc";
                // Send a mail only if this a new entry, or if this is an
                // edited entry but we have to send mail on every change,
                // and if mrbsCreateRepeatingEntrys is successful
                if ((isset($id) && MAIL_ADMIN_ALL or !isset($id)) && 0 != $new_id) {
                    // Get room name and area name. Would be better to avoid
                    // a database access just for that. Ran only if we need
                    // details
                    if (MAIL_DETAILS) {
                        $sql = "SELECT r.id, r.room_name, r.area_id, a.area_name ";
                        $sql .= "FROM {$tbl_room} r, {$tbl_area} a ";
                        $sql .= "WHERE r.id={$room_id} AND r.area_id = a.id";
                        $res = sql_query($sql);
예제 #2
0
 $beneficiaire = $dataForCreate['beneficiaire'];
 $beneficiaire_ext = $dataForCreate['beneficiaire_ext'];
 $name = $dataForCreate['name'];
 $type = $dataForCreate['type'];
 $description = $dataForCreate['description'];
 $option_reservation = $dataForCreate['option_reservation'];
 $overload_data = $dataForCreate['overload_data'];
 $entry_moderate = $dataForCreate['entry_moderate'];
 $rep_jour_c = $dataForCreate['rep_jour_c'];
 $statut_entry = $dataForCreate['statut_entry'];
 $keys = $dataForCreate['keys'];
 $courrier = $dataForCreate['courrier'];
 $area_id = $dataForCreate['area'];
 $send_mail_moderate = $dataForCreate['send_mail_moderate'];
 if ($rep_type != 0) {
     mrbsCreateRepeatingEntrys($starttime, $endtime, $rep_type, $rep_enddate, $rep_opt, $room_id, $create_by, $beneficiaire, $beneficiaire_ext, $name, $type, $description, $rep_num_weeks, $option_reservation, $overload_data, $entry_moderate, $rep_jour_c, $courrier, $rep_month_abs1, $rep_month_abs2);
     /* var globale crée par la fonction ci dessus */
     $idPourEvent = $id_first_resa;
     if (Settings::get('automatic_mail') == 'yes') {
         if (isset($id) && $id != 0) {
             if ($send_mail_moderate) {
                 $message_error = send_mail($id_first_resa, 5, $dformat);
             } else {
                 $message_error = send_mail($id_first_resa, 2, $dformat);
             }
         } else {
             if ($send_mail_moderate) {
                 $message_error = send_mail($id_first_resa, 5, $dformat);
             } else {
                 $message_error = send_mail($id_first_resa, 1, $dformat);
             }
예제 #3
0
}
// end foreach rooms
// If the rooms were free, go ahead an process the bookings
if ($valid_booking) {
    foreach ($rooms as $room_id) {
        // If we're using provisional booking then we need to work out whether the
        // status of this booking is confirmed.   If the user is allowed to confirm
        // bookings for this room, then the status will be confirmed , since they are
        // in effect immediately confirming their own booking.
        if ($provisional_enabled) {
            $status = auth_book_admin($user, $room_id) ? STATUS_CONFIRMED : STATUS_PROVISIONAL;
        } else {
            $status = STATUS_CONFIRMED;
        }
        if ($edit_type == "series") {
            $booking = mrbsCreateRepeatingEntrys($starttime, $endtime, $rep_type, $rep_enddate, $rep_opt, $room_id, $create_by, $name, $type, $description, isset($rep_num_weeks) ? $rep_num_weeks : 0, $isprivate, $status);
            $new_id = $booking['id'];
            // Send a mail to the Administrator
            if ($mail_settings['admin_on_bookings'] or $mail_settings['area_admin_on_bookings'] or $mail_settings['room_admin_on_bookings'] or $mail_settings['booker'] or $mail_settings['book_admin_on_provisional']) {
                require_once "functions_mail.inc";
                // Send a mail only if this a new entry, or if this is an
                // edited entry but we have to send mail on every change,
                // and if mrbsCreateRepeatingEntrys is successful
                if ((isset($id) && $mail_settings['admin_all'] or !isset($id)) && 0 != $new_id) {
                    // Get room name and area name. Would be better to avoid
                    // a database access just for that. Ran only if we need
                    // details
                    if ($mail_settings['details']) {
                        $sql = "SELECT r.id AS room_id, r.room_name, r.area_id, a.area_name ";
                        $sql .= "FROM {$tbl_room} r, {$tbl_area} a ";
                        $sql .= "WHERE r.id={$room_id} AND r.area_id = a.id";
     if ($repeat_id > 0) {
         // Mark changed entry in a series with entry_type:
         $data['entry_type'] = ENTRY_RPT_CHANGED;
         // Keep the same recurrence id (this never changes once an entry has been made)
         $data['ical_recur_id'] = $ical_recur_id;
     } else {
         $data['entry_type'] = ENTRY_SINGLE;
     }
     $data['entry_type'] = $repeat_id > 0 ? ENTRY_RPT_CHANGED : ENTRY_SINGLE;
     $data['repeat_id'] = $repeat_id;
 }
 // The following elements are needed for email notifications
 $data['duration'] = $duration;
 $data['dur_units'] = $dur_units;
 if ($edit_type == "series") {
     $booking = mrbsCreateRepeatingEntrys($data);
     $new_id = $booking['id'];
     $is_repeat_table = $booking['series'];
     $data['id'] = $new_id;
     // Add in the id now we know it
 } else {
     // Create the entry:
     $new_id = mrbsCreateSingleEntry($data);
     $is_repeat_table = FALSE;
     $data['id'] = $new_id;
     // Add in the id now we know it
 }
 // Send an email if neccessary, provided that the entry creation was successful
 if ($need_to_send_mail && !empty($new_id)) {
     // Only send an email if (a) this is a changed entry and we have to send emails
     // on change or (b) it's a new entry and we have to send emails for new entries
예제 #5
0
        for ($i = 0; $i < count($reps); $i++) {
            $tmp = mrbsCheckFree($room_id, $reps[$i], $reps[$i] + $diff, $ignore_id, $repeat_id);
            if (!empty($tmp)) {
                $err = $err . $tmp;
            }
        }
    } else {
        $err = $lang["too_may_entrys"] . "<P>";
        $hide_title = 1;
    }
} else {
    $err = mrbsCheckFree($room_id, $starttime, $endtime - 1, $ignore_id, 0);
}
if (empty($err)) {
    if ($edit_type == "series") {
        mrbsCreateRepeatingEntrys($starttime, $endtime, $rep_type, $rep_enddate, $rep_opt, $room_id, $create_by, $name, $type, $description);
    } else {
        # Mark changed entry in a series with entry_type 2:
        if ($repeat_id > 0) {
            $entry_type = 2;
        } else {
            $entry_type = 0;
        }
        # Create the entry:
        mrbsCreateSingleEntry($starttime, $endtime, $entry_type, $repeat_id, $room_id, $create_by, $name, $type, $description);
    }
    # Delete the original entry
    if (isset($id)) {
        mrbsDelEntry(getUserName(), $id, $edit_type == "series", 1);
    }
    sql_mutex_unlock('mrbs_entry');