science-ation/db/db.update.142.php

22 lines
792 B
PHP
Raw Normal View History

2009-10-02 17:24:53 +00:00
<?
function db_update_142_post() {
2024-12-11 00:40:23 +00:00
$q=$pdo->prepare("SELECT * FROM config WHERE var='FISCALYEAR'");
$q->execute();
if($q->rowCount()) {
2009-10-02 17:24:53 +00:00
//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");
2024-12-11 00:40:23 +00:00
$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();
2009-10-02 17:24:53 +00:00
}
}
?>