return false;
}
+ /*
+ Selectively extends access to selected security areas/sections.
+ */
+ function update_security_roles($sec_updates)
+ {
+ global $security_areas, $security_sections;
+
+ $roles = db_query("SELECT * FROM ".TB_PREF."security_roles");
+
+ while($role = db_fetch($roles))
+ {
+ $role['areas'] = explode(';', $role['areas']);
+ $role['sections'] = explode(';', $role['sections']);
+ foreach($sec_updates as $has => $add)
+ {
+ if (in_array($security_areas[$has][0], $role['areas']))
+ {
+ $sections = array();
+ foreach($add as $area)
+ {
+ $role['areas'][] = $security_areas[$area][0];
+ $role['sections'][] = $security_areas[$area][0]&~0xff;
+ }
+ sort($role['areas']);
+ update_security_role($role['id'], $role['role'], $role['description'],
+ array_values($role['sections']), array_values($role['areas']));
+ }
+ }
+ }
+ return true;
+ }
+
/*
Check and disable incompatible extensions.
*/
'SA_ASSETSTRANSVIEW' => array(SS_ASSETS|1, _("Fixed Asset transactions view")),
'SA_ASSETTRANSFER' => array(SS_ASSETS|2, _("Fixed Asset location transfers")),
'SA_ASSETDISPOSAL' => array(SS_ASSETS|3, _("Fixed Asset disposals")),
- 'SA_DEPRECIATION' => array(SS_ASSETS|4, _("Depreciation")),
+ 'SA_DEPRECIATION' => array(SS_ASSETS|4, _("Depreciation")),
'SA_ASSETSANALYTIC' => array(SS_ASSETS_A|1, _("Fixed Asset analytical reports and inquiries")),
//-----------------------------------------------------------------------------------------------
function fixed_asset_classes_list($name, $selected_id=null, $spec_opt=false, $submit_on_change=false)
{
- $sql = "SELECT c.fa_class_id, CONCAT(c.fa_class_id,' - ',c.description) `desc`, CONCAT(p.fa_class_id,' - ',p.description), c.inactive FROM ".TB_PREF."stock_fa_class c, ".TB_PREF."stock_fa_class p WHERE c.parent_id=p.fa_class_id";
+ $sql = "SELECT c.fa_class_id, CONCAT(c.fa_class_id,' - ',c.description) `desc`, CONCAT(p.fa_class_id,' - ',p.description), c.inactive FROM "
+ .TB_PREF."stock_fa_class c, "
+ .TB_PREF."stock_fa_class p
+ WHERE c.parent_id=p.fa_class_id";
return combo_input($name, $selected_id, $sql, 'c.fa_class_id', 'desc',
array('order'=>'c.fa_class_id',
--- /dev/null
+<?php
+/**********************************************************************
+ Copyright (C) FrontAccounting, LLC.
+ Released under the terms of the GNU General Public License, GPL,
+ as published by the Free Software Foundation, either version 3
+ of the License, or (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
+***********************************************************************/
+
+class fa2_4rc1 extends fa_patch {
+ var $previous = '2.4.0'; // applicable database version
+ var $version = '2.4.1'; // version installed
+ var $description;
+ var $sql = ''; // 'alter2.4rc1.sql';
+ var $preconf = true;
+
+ function fa2_4rc1() {
+ parent::fa_patch();
+ $this->description = _('Upgrade from version 2.4beta to 2.4rc1');
+ }
+
+ //
+ // Install procedure. All additional changes
+ // not included in sql file should go here.
+ //
+ function install($company, $force=false)
+ {
+ // key
+ $sec_updates = array(
+ 'SA_SETUPCOMPANY' => array(
+ 'SA_ASSET', 'SA_ASSETCATEGORY', 'SA_ASSETCLASS',
+ 'SA_ASSETSTRANSVIEW','SA_ASSETTRANSFER', 'SA_ASSETDISPOSAL',
+ 'SA_DEPRECIATION', 'SA_ASSETSANALYTIC'),
+ );
+ $result = $this->update_security_roles($sec_updates);
+ return $result;
+ }
+
+ //
+ // optional procedure done after upgrade fail, before backup is restored
+ //
+ function post_fail($company)
+ {
+ $pref = $this->companies[$company]['tbpref'];
+ db_query("DROP TABLE IF EXISTS " . $pref . 'stock_fa_class');
+ }
+
+}
+
+$install = new fa2_4rc1;
--- /dev/null
+ALTER TABLE `0_locations` ADD COLUMN `fixed_asset` tinyint(1) NOT NULL DEFAULT '0' after `contact`;
+
+DROP TABLE IF EXISTS `0_stock_fa_class`;
+CREATE TABLE `0_stock_fa_class` (
+ `fa_class_id` varchar(20) NOT NULL DEFAULT '',
+ `parent_id` varchar(20) NOT NULL DEFAULT '',
+ `description` varchar(200) NOT NULL DEFAULT '',
+ `long_description` tinytext NOT NULL,
+ `depreciation_method` char(1) NOT NULL DEFAULT 'D',
+ `depreciation_rate` double NOT NULL DEFAULT '0',
+ `depreciation_period` tinyint(1) NOT NULL DEFAULT '0',
+ `inactive` tinyint(1) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`fa_class_id`)
+) ENGINE=InnoDB;
+
+ALTER TABLE `0_stock_master` ADD COLUMN `depreciation_method` char(1) NOT NULL DEFAULT 'D' AFTER `editable`;
+ALTER TABLE `0_stock_master` ADD COLUMN `depreciation_rate` double NOT NULL DEFAULT '0' AFTER `depreciation_method`;
+ALTER TABLE `0_stock_master` ADD COLUMN `depreciation_start` date NOT NULL DEFAULT '0000-00-00' AFTER `depreciation_rate`;
+ALTER TABLE `0_stock_master` ADD COLUMN `depreciation_date` date NOT NULL DEFAULT '0000-00-00' AFTER `depreciation_start`;
+ALTER TABLE `0_stock_master` ADD COLUMN `fa_class_id` varchar(20) NOT NULL DEFAULT '' AFTER `depreciation_date`;
+
+INSERT INTO `0_sys_prefs` VALUES ('default_loss_on_asset_disposal_act', 'glsetup.items', 'varchar', '15', '5660');
+INSERT INTO `0_sys_prefs` VALUES ('depreciation_period', 'glsetup.company', 'tinyint', '1', '1');
+