cron-itsupport.php 1.1 KB
<?php

require_once "lib/3rdparty/php-redmine-api/lib/Redmine/Api/AbstractApi.php";
require_once "lib/3rdparty/php-redmine-api/lib/Redmine/Api/SimpleXMLElement.php";
require_once "lib/3rdparty/php-redmine-api/lib/Redmine/Api/IssueStatus.php";
require_once "lib/3rdparty/php-redmine-api/lib/Redmine/Api/User.php";
require_once "lib/3rdparty/php-redmine-api/lib/Redmine/Api/Issue.php";
require_once "lib/3rdparty/php-redmine-api/lib/Redmine/Api/Attachment.php";
require_once "lib/3rdparty/php-redmine-api/lib/Redmine/Client.php";

require_once "config.php";

$redmine = new Redmine\Client('https://tasks.mephi.ru', REDMINE_API);

/* NRNU Auto-report */

$answer = $redmine->api('issue')->all(array(
		'project_id'		=> '121', 			// project "it-support"
//		'status_id'		=> STATUSID_NEW,
	));

if (!isset($answer['issues']))
	exit(0);

foreach ($answer['issues'] as &$issue) {
	if (!isset($issue['due_date'])) {
		$changes = array();
		$created_on = strtotime($issue['created_on']);

		$changes['due_date'] = strftime('%Y-%m-%d', $created_on+(3600*24*3));

		$redmine->api('issue')->update($issue['id'], $changes);
	}
	continue;
}

?>