예제 #1
0
 function guessMappings()
 {
     $si_user = new SI_User();
     $si_users = $si_user->getAll();
     if ($si_users !== false) {
         for ($i = 0; $i < count($si_users); $i++) {
             $normalized_name = $this->normalize($si_users[$i]->first_name . ' ' . $si_users[$i]->last_name);
             if (isset($this->users[$normalized_name])) {
                 $this->users[$normalized_name]['action'] = SI_IMPORT_ACTION_MAP;
                 $this->users[$normalized_name]['param'] = $si_users[$i]->id;
                 continue;
             }
             $normalized_name = $this->normalize($si_users[$i]->last_name . ' ' . $si_users[$i]->first_name);
             if (isset($this->users[$normalized_name])) {
                 $this->users[$normalized_name]['action'] = SI_IMPORT_ACTION_MAP;
                 $this->users[$normalized_name]['param'] = $si_users[$i]->id;
                 continue;
             }
         }
     }
     $si_task = new SI_Task();
     $si_tasks = $si_task->retrieveSet();
     if ($si_tasks !== false) {
         for ($i = 0; $i < count($si_tasks); $i++) {
             $normalized_name = $this->normalize($si_tasks[$i]->name);
             if (isset($this->tasks[$normalized_name])) {
                 $this->tasks[$normalized_name]['action'] = SI_IMPORT_ACTION_MAP;
                 $this->tasks[$normalized_name]['param'] = $si_tasks[$i]->id;
                 continue;
             }
         }
     }
     $si_item_code = new SI_ItemCode();
     $si_item_codes = $si_item_code->retrieveSet();
     if ($si_item_codes !== false) {
         for ($i = 0; $i < count($si_item_codes); $i++) {
             $normalized_name = $this->normalize($si_item_codes[$i]->code);
             if (isset($this->item_codes[$normalized_name])) {
                 $this->item_codes[$normalized_name]['action'] = SI_IMPORT_ACTION_MAP;
                 $this->item_codes[$normalized_name]['param'] = $si_item_codes[$i]->id;
                 continue;
             }
             $normalized_name = $this->normalize($si_item_codes[$i]->description);
             if (isset($this->item_codes[$normalized_name])) {
                 $this->item_codes[$normalized_name]['action'] = SI_IMPORT_ACTION_MAP;
                 $this->item_codes[$normalized_name]['param'] = $si_item_codes[$i]->id;
                 continue;
             }
             $normalized_name = $this->normalize($si_item_codes[$i]->code . ' - ' . $si_item_codes[$i]->description);
             if (isset($this->item_codes[$normalized_name])) {
                 $this->item_codes[$normalized_name]['action'] = SI_IMPORT_ACTION_MAP;
                 $this->item_codes[$normalized_name]['param'] = $si_item_codes[$i]->id;
                 continue;
             }
         }
     }
 }
예제 #2
0
require_once('includes/SI_PaymentSchedule.php');

checkLogin();

$project = new SI_Project();
$tasks = array();

if(!empty($_REQUEST['id'])){
	$project->get($_REQUEST['id']);
	if(!$project->hasRights(PROJECT_RIGHT_VIEW)){
		fatal_error('Insufficent access rights for this project!');
	}

	$task = new SI_Task();
	if($_REQUEST['filter'] == "all"){
		$tasks = $task->retrieveSet("t.deleted = 'N' AND t.project_id = ".$project->id);
	}else{
		$tasks = $task->retrieveSet("t.deleted = 'N' AND t.project_id = ".$project->id." AND s.completed = 'N'");
	}
	if($tasks === FALSE){
		$error_msg .= "Error retrieving tasks for project!\n";
		debug_message($task->getLastError());
	}
}else{
	fatal_error("Project ID must be supplied!\n");
}

// Get this projects payment schedule
$ps = new SI_PaymentSchedule();
$items = $ps->getForProject($project->id);
if($items === FALSE){