Exemplo n.º 1
0
     $_POST['modify_id'] = $_SESSION['sess_user_name'];
     $_POST['create_time'] = date('YmdHis');
     $_POST['modify_time'] = date('YmdHis');
     $dept_obj->setDataArray($_POST);
     if ($dept_obj->insertDataFromInternalArray()) {
         # Get the inserted primary key as department nr.
         $oid = $db->Insert_ID();
         $dept_nr = $dept_obj->LastInsertPK('nr', $oid);
         # If telephone/beeper info available, save into the phone table
         if ($_POST['inphone1'] || $_POST['inphone2'] || $_POST['inphone3'] || $_POST['funk1'] || $_POST['funk2']) {
             $_POST['dept_nr'] = $dept_nr;
             $_POST['name'] = $_POST['name_formal'];
             $_POST['vorname'] = $_POST['id'];
             $comm->setDataArray($_POST);
             if (!@$comm->insertDataFromInternalArray()) {
                 echo $comm->getLastQuery() . "<br>{$LDDbNosave}";
             }
         }
         # Save the uploaded image
         if ($is_img) {
             $picfilename = 'dept_' . $dept_nr . '.' . $picext;
             copy($_FILES['img']['tmp_name'], $root_path . $dept_logos_path . $picfilename);
         }
         header("location:dept_info.php" . URL_REDIRECT_APPEND . "&edit=1&mode=newdata&dept_nr={$dept_nr}");
         exit;
     } else {
         echo $dept_obj->getLastQuery . "<br>{$LDDbNoSave}";
     }
     break;
 case 'update':
     $_POST['history'] = $dept_obj->ConcatHistory("Update: " . date('Y-m-d H:i:s') . " " . $_SESSION['sess_user_name'] . "\n");