science-ation/db/db.update.142.php
2024-12-10 19:40:23 -05:00

22 lines
792 B
PHP

<?
function db_update_142_post() {
$q=$pdo->prepare("SELECT * FROM config WHERE var='FISCALYEAR'");
$q->execute();
if($q->rowCount()) {
//great its there, do nothing, it must have been inserted by the installer when doing a fresh install
}
else {
//its not there.. this must be an update to an existing system, so lets insert it
//try to guess a fiscal that makes sense
$month=date("m");
if($month>6) $fiscalyearsuggest=date("Y")+1;
else $fiscalyearsuggest=date("Y");
$stmt = $pdo->prepare("INSERT INTO `config` ( `var` , `val` , `category` , `type` , `type_values` , `ord` , `description` , `year`) VALUES ( 'FISCALYEAR', '$fiscalyearsuggest', 'Special', '', '', '0', 'The current fiscal year that the fundraising module is using', '0')");
$stmt->execute();
}
}
?>