Example #1
0
    $check_notify = FALSE;
}
foreach ($focus->column_fields as $field) {
    if (isset($_POST[$field])) {
        $value = $_POST[$field];
        $focus->{$field} = $value;
    }
}
foreach ($focus->additional_column_fields as $field) {
    if (isset($_POST[$field])) {
        $value = $_POST[$field];
        $focus->{$field} = $value;
    }
}
$focus->name = $mod_strings["LBL_NAME_FIRST"] . ' ' . $focus->transports_tbookings_name;
$focus->save($check_notify);
$return_id = $focus->id;
$deleted_count = 0;
// save to modules TransportBookingsLine
$line = array('id_booking' => $_POST['id_booking'], 'name_booking' => $_POST['name_booking'], 'operating_date' => $_POST['operating_date'], 'unit_price' => $_POST['unit_price'], 'type' => $_POST['type'], 'route' => $_POST['route'], 'deleted' => $_POST['deleted']);
// save contract_values
$transport_bookings_line_count = count($line['id_booking']);
for ($i = 0; $i < $transport_bookings_line_count; $i++) {
    $deleted = $line['deleted'][$deleted_count];
    if (($line['name_booking'][$i] == '' || $line['name_booking'][$i] == '0') && ($line['operating_date'][$i] == '' || $line['operating_date'][$i] == '0') && ($line['unit_price'][$i] == '' || $line['unit_price'][$i] == '0') && ($line['type'][$i] == '' || $line['type'][$i] == '0') && ($line['route'][$i] == '' || $line['route'][$i] == '0')) {
        $deleted = 1;
    }
    $transport_bookings_line = new TransportBookingsLine();
    $transport_bookings_line->id = $line['id_booking'][$i];
    $transport_bookings_line->transportbookings_id = $return_id;
    $transport_bookings_line->name_booking = $line['name_booking'][$i];
 function createTransportBooking($bean, $vanchuyen = '')
 {
     global $db;
     $sql = "\r\n            SELECT \r\n              a.id \r\n            FROM\r\n              `transportbookings` a \r\n              JOIN `transports_portbookings_c` b \r\n                ON a.`id` = b.`transportsc2aeookings_idb` \r\n                AND b.`deleted` = 0 \r\n              JOIN `cars` c \r\n                ON c.`transport_id` = b.`transports6e65nsports_ida` \r\n                AND c.`deleted` = 0 \r\n                AND c.`id` = '{$vanchuyen->vanchuyen_name}' \r\n              JOIN `groupprograportbookings_c` d \r\n                ON d.`groupprogrdcceookings_idb` = a.`id` \r\n                AND d.`groupprogrd5earograms_ida` = '{$bean->id}' \r\n                AND d.`deleted` = 0 \r\n            WHERE a.`deleted` = 0 \r\n            ";
     $TransportBooking = new TransportBookings();
     $result = $db->query($sql);
     while ($row = $db->fetchByAssoc($result)) {
         $TransportBooking->id = $row['id'];
     }
     $TransportBooking->groupprogratbookings_name = $bean->name;
     $TransportBooking->groupprogrd5earograms_ida = $bean->id;
     $sql = "\r\n            SELECT \r\n              a.* \r\n            FROM\r\n              `transports` a \r\n              JOIN cars b \r\n                ON b.`transport_id` = a.`id` \r\n                AND b.`deleted` = 0 \r\n                AND b.`id` = '{$vanchuyen->vanchuyen_name}' \r\n            WHERE a.`deleted` = 0\r\n            ";
     $result = $db->query($sql);
     $row = $db->fetchByAssoc($result);
     $TransportBooking->transports6e65nsports_ida = $row['id'];
     $TransportBooking->transports_tbookings_name = $row['name'];
     $TransportBooking->address = $row['address'];
     $TransportBooking->tel_to = $row['phone'];
     $TransportBooking->confirm = 0;
     $TransportBooking->name = 'Transport Bookings To ' . $row['name'];
     $TransportBooking->assigned_user_name = $bean->assigned_user_name;
     $TransportBooking->assigned_user_id = $bean->assigned_user_id;
     $return = $TransportBooking->save();
     return $return;
 }