Fixing defaultuser admin.

1.9.x
Julio Montoya 12 years ago
parent 110fa5207a
commit 91ee6d5f01
  1. 4
      main/cron/import_csv.php
  2. 23
      main/inc/lib/sessionmanager.lib.php

@ -486,10 +486,6 @@ class ImportCsv
} else {
$this->logger->addError("Courses - Can't create course:".$row['title']);
}
} else {
// Update
$params = array(

@ -1870,12 +1870,17 @@ class SessionManager
* @param $logger
* @param array convert a file row to an extra field. Example in CSV file there's a SessionID then it will
* converted to extra_external_session_id if you set this: array('SessionId' => 'extra_external_session_id')
* @param array extra fields
* @param string extra field id
* @param int $daysCoachAccessBeforeBeginning
* @param int $daysCoachAccessAfterBeginning
* @param int $sessionVisibility
* @return array
*/
static function importCSV(
$file,
$updatesession,
$user_id = null,
$defaultUserId = null,
$logger = null,
$extraFields = array(),
$extraFieldId = null,
@ -1889,8 +1894,8 @@ class SessionManager
$error_message = null;
$session_counter = 0;
if (empty($user_id)) {
$user_id = api_get_user_id();
if (empty($defaultUserId)) {
$defaultUserId = api_get_user_id();
}
$eol = PHP_EOL;
@ -1910,10 +1915,6 @@ class SessionManager
$extraParameters .= ' , nb_days_access_after_end = '.intval($daysCoachAccessAfterBeginning);
}
if (!empty($sessionVisibility)) {
$extraParameters .= ' , visibility = '.intval($sessionVisibility);
}
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
@ -1958,7 +1959,7 @@ class SessionManager
$session_name = Database::escape_string($enreg['SessionName']);
$date_start = $enreg['DateStart'];
$date_end = $enreg['DateEnd'];
$visibility = $enreg['Visibility'];
$visibility = isset($enreg['Visibility']) ? $enreg['Visibility'] : $sessionVisibility;
$session_category_id = $enreg['SessionCategory'];
// Searching a coach.
@ -1966,10 +1967,10 @@ class SessionManager
$coach_id = UserManager::get_user_id_from_username($enreg['Coach']);
if ($coach_id === false) {
// If the coach-user does not exist - I'm the coach.
$coach_id = api_get_user_id();
$coach_id = $defaultUserId;
}
} else {
$coach_id = api_get_user_id();
$coach_id = $defaultUserId;
}
if (!$updatesession) {
@ -2000,7 +2001,7 @@ class SessionManager
date_end = '$date_end',
visibility = '$visibility',
session_category_id = '$session_category_id',
session_admin_id=".intval($user_id).$extraParameters;
session_admin_id=".intval($defaultUserId).$extraParameters;
Database::query($sql_session);
$session_id = Database::insert_id();

Loading…
Cancel
Save