[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [6902] Merge 6898:6901 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [6902] Merge 6898:6901 from trunk |
Date: |
Tue, 01 Feb 2011 12:59:53 +0000 |
Revision: 6902
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6902
Author: sigurdne
Date: 2011-02-01 12:59:53 +0000 (Tue, 01 Feb 2011)
Log Message:
-----------
Merge 6898:6901 from trunk
Modified Paths:
--------------
branches/Version-1_0-branch/phpgwapi/inc/class.account.inc.php
branches/Version-1_0-branch/phpgwapi/setup/phpgw_no.lang
branches/Version-1_0-branch/preferences/setup/phpgw_no.lang
branches/Version-1_0-branch/property/inc/class.boentity.inc.php
branches/Version-1_0-branch/property/inc/class.uientity.inc.php
Removed Paths:
-------------
branches/Version-1_0-branch/property/koble_bygg_gatetabell.php
branches/Version-1_0-branch/property/organize_pdf_BKB.php
Property Changed:
----------------
branches/Version-1_0-branch/
Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
-
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897
+
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901
Modified: branches/Version-1_0-branch/phpgwapi/inc/class.account.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.account.inc.php
2011-02-01 12:58:33 UTC (rev 6901)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.account.inc.php
2011-02-01 12:59:53 UTC (rev 6902)
@@ -710,25 +710,38 @@
}
else
{
+ $error = array();
switch (
$GLOBALS['phpgw_info']['server']['password_level'] )
{
default:
case 'NONALPHA':
-
self::_validate_password_level_nonalpha($passwd);
+ $error[] =
self::_validate_password_level_nonalpha($passwd);
// fall through
case '1NUM':
-
self::_validate_password_level_1num($passwd);
+ $error[] =
self::_validate_password_level_1num($passwd);
// fall through
case '2LOW':
-
self::_validate_password_level_2low($passwd);
+ $error[] =
self::_validate_password_level_2low($passwd);
// fall through
case '2UPPER':
-
self::_validate_password_level_2upper($passwd);
+ $error[] =
self::_validate_password_level_2upper($passwd);
// fall through
case '8CHAR':
-
self::_validate_password_level_8char($passwd);
+ $error[] =
self::_validate_password_level_8char($passwd);
}
}
+ if($error)
+ {
+ $msq = array();
+ foreach($error as $_msq)
+ {
+ if($_msq)
+ {
+ $msq[] = $_msq;
+ }
+ }
+ throw new
Exception(implode('<br/>',array_reverse($msq)));
+ }
}
/**
@@ -740,11 +753,14 @@
*/
protected static function
_validate_password_level_8char($passwd)
{
+ $error = '';
$len = strlen($passwd);
if ( $len < 8 )
{
- throw new Exception(lang('Password must be at
least 8 characters long, not %1', $len));
+ $error = lang('Password must be at least 8
characters long, not %1', $len);
+ //throw new Exception(lang('Password must be at
least 8 characters long, not %1', $len));
}
+ return $error;
}
/**
@@ -756,11 +772,14 @@
*/
protected static function
_validate_password_level_2upper($passwd)
{
+ $error = '';
$m = array();
if ( preg_match_all('/[A-Z]/', $passwd, $m) < 2 )
{
- throw new Exception(lang('Password must contain
at least 2 upper case characters'));
+ $error = lang('Password must contain at least 2
upper case characters');
+ //throw new Exception(lang('Password must
contain at least 2 upper case characters'));
}
+ return $error;
}
/**
* Check that a password contain at least 2 lower case
characters
@@ -771,11 +790,14 @@
*/
protected static function _validate_password_level_2low($passwd)
{
+ $error = '';
$m = array();
if ( preg_match_all('/[a-z]/', $passwd, $m) < 2 )
{
- throw new Exception(lang('Password must contain
at least 2 lower case characters'));
+ $error = lang('Password must contain at least 2
lower case characters');
+ //throw new Exception(lang('Password must
contain at least 2 lower case characters'));
}
+ return $error;
}
/**
* Check that a password contain at least 1 number
@@ -786,11 +808,14 @@
*/
protected static function _validate_password_level_1num($passwd)
{
+ $error = '';
$m = array();
if ( !preg_match_all('/[0-9]/', $passwd, $m) )
{
- throw new Exception(lang('Password must contain
at least 1 number'));
+ $error = lang('Password must contain at least 1
number');
+ //throw new Exception(lang('Password must
contain at least 1 number'));
}
+ return $error;
}
/**
* Check that a password contain at least 1 non alphanumeric
character
@@ -801,11 +826,14 @@
*/
protected static function
_validate_password_level_nonalpha($passwd)
{
+ $error = '';
$m = array();
if ( !preg_match_all('/\W/', $passwd, $m) )
{
- throw new Exception(lang('Password must contain
at least 1 non alphanumeric character'));
+ $error = lang('Password must contain at least 1
non alphanumeric character');
+ //throw new Exception(lang('Password must
contain at least 1 non alphanumeric character'));
}
+ return $error;
}
/**
Modified: branches/Version-1_0-branch/phpgwapi/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/phpgwapi/setup/phpgw_no.lang 2011-02-01
12:58:33 UTC (rev 6901)
+++ branches/Version-1_0-branch/phpgwapi/setup/phpgw_no.lang 2011-02-01
12:59:53 UTC (rev 6902)
@@ -129,3 +129,8 @@
version common no versjon
you have been successfully logged out login no Du har nå logget ut
Info: you have changed domain from "%1" to "%2" login no
Informasjon: Du har endret domene fra "%1" til "%2"
+Password must be at least 8 characters long, not %1 common no Passord
må være minst på 8 tegn, du forsøker med %1
+Password must contain at least 2 upper case characters common no Passord
må inneholde minst 2 store bosktaver
+Password must contain at least 2 lower case characters common no Passord
må inneholde minst 2 små bosktaver
+Password must contain at least 1 number common no Passord må
inneholde minst 1 tall
+Password must contain at least 1 non alphanumeric character common no
Passord må inneholde minst 1 spesialtegn
Modified: branches/Version-1_0-branch/preferences/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/preferences/setup/phpgw_no.lang 2011-02-01
12:58:33 UTC (rev 6901)
+++ branches/Version-1_0-branch/preferences/setup/phpgw_no.lang 2011-02-01
12:59:53 UTC (rev 6902)
@@ -5,7 +5,7 @@
enter your new password preferences no Skriv inn ditt nye
passord
language preferences no Språk
max matchs per page preferences no Max matches per side
-note: this feature does *not* change your email password. this will need to be
done manually. preferences no Noter: Denne funksonen endrer *ikke*
ditt epost passord. Dette må gjøres manuellt.
+note: this feature does *not* change your email password. this will need to be
done manually. preferences no Noter: Denne funksjonen endrer *ikke*
ditt epost passord. Dette må gjøres manuellt.
please, select a new theme preferences no Vennligst velg et nytt
tema
re-enter your password preferences no Skriv inn ditt passord igjen
select different theme preferences no Velg annet tema
Modified: branches/Version-1_0-branch/property/inc/class.boentity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boentity.inc.php
2011-02-01 12:58:33 UTC (rev 6901)
+++ branches/Version-1_0-branch/property/inc/class.boentity.inc.php
2011-02-01 12:59:53 UTC (rev 6902)
@@ -213,7 +213,7 @@
break;
}
- $categories=
$this->soadmin_entity->read_category(array('allrows'=>true,'entity_id'=>$this->entity_id,
'required' => $required));
+ $categories=
$this->soadmin_entity->read_category(array('allrows'=>true,'entity_id'=>$this->entity_id,
'required' => $required, 'order' => 'name', 'sort' => 'ASC'));
return
$this->bocommon->select_list($selected,$categories);
}
Modified: branches/Version-1_0-branch/property/inc/class.uientity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uientity.inc.php
2011-02-01 12:58:33 UTC (rev 6901)
+++ branches/Version-1_0-branch/property/inc/class.uientity.inc.php
2011-02-01 12:59:53 UTC (rev 6902)
@@ -347,6 +347,7 @@
$start_date = urldecode($this->start_date);
$end_date = urldecode($this->end_date);
$dry_run = false;
+ $second_display = phpgw::get_var('second_display',
'bool');
$this->save_sessiondata();
@@ -361,7 +362,14 @@
$group_filters = 'filter';
$GLOBALS['phpgw']->xslttpl->add_file(array('search_field'));
}
+ $default_district =
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['default_district'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['default_district']:'');
+ if ($default_district && !$second_display &&
!$this->district_id)
+ {
+ $this->bo->district_id = $default_district;
+ $this->district_id =
$default_district;
+ }
+
$datatable = array();
$values_combo_box = array();
@@ -376,14 +384,17 @@
'menuaction'
=> 'property.uientity.index',
'entity_id'
=> $this->entity_id,
'cat_id' =>
$this->cat_id,
- 'type'
=> $this->type
+ 'type'
=> $this->type,
+ 'district_id'
=> $this->district_id
));
$datatable['config']['allow_allrows'] = true;
$datatable['config']['base_java_url'] =
"menuaction:'property.uientity.index',".
+ "second_display:1,".
"entity_id:'{$this->entity_id}',".
"cat_id:'{$this->cat_id}',".
- "type:'{$this->type}'";
+ "type:'{$this->type}',".
+ "district_id:'{$this->district_id}'";
// this array "$arr_filter_hide" indicate what
filters are hidden or not
$arr_filter_hide = array();
@@ -452,10 +463,11 @@
'action' =>
$GLOBALS['phpgw']->link('/index.php',
array
(
- 'menuaction'
=> 'property.uientity.index',
- 'entity_id'
=> $this->entity_id,
- 'cat_id'
=> $this->cat_id,
- 'type'
=> $this->type
+ 'menuaction'
=> 'property.uientity.index',
+
'second_display' => $second_display,
+ 'entity_id'
=> $this->entity_id,
+ 'cat_id'
=> $this->cat_id,
+ 'type'
=> $this->type
)),
'fields' => array
(
Deleted: branches/Version-1_0-branch/property/koble_bygg_gatetabell.php
===================================================================
--- branches/Version-1_0-branch/property/koble_bygg_gatetabell.php
2011-02-01 12:58:33 UTC (rev 6901)
+++ branches/Version-1_0-branch/property/koble_bygg_gatetabell.php
2011-02-01 12:59:53 UTC (rev 6902)
@@ -1,191 +0,0 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2010 Free Software Foundation, Inc.
http://www.fsf.org/
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
- * @package property
- * @subpackage custom
- * @version $Id$
- */
-
- /**
- * Description
- * @package property
- */
-
- $GLOBALS['phpgw_info']['flags'] = array
- (
- 'currentapp' => 'property'
- );
-
- include_once('../header.inc.php');
-
-
- if ( isset($GLOBALS['phpgw_info']['user']['apps']['admin']) )
- {
- $organize = new koble_bygg_gatetabell();
- $organize->pre_run();
- }
- else
- {
- echo 'go away';
- }
-
-
- class koble_bygg_gatetabell
- {
- /* In Admin->Property->Async servises:
- * Name: property.custom_functions.index
- * Data:
function=koble_bygg_gatetabell,dir=C:/path/to/gatetabell
- */
-
- var $function_name = 'koble_bygg_gatetabell';
-
- function koble_bygg_gatetabell()
- {
- $this->db = &
$GLOBALS['phpgw']->db;
- $this->db2 = clone($this->db);
- }
-
- function pre_run()
- {
-
- $confirm = get_var('confirm',array('POST'));
- $execute = get_var('execute',array('GET'));
-
- if(!$execute)
- {
- $dry_run=True;
- }
-
- if ($confirm)
- {
- $this->execute($dry_run,$cron);
- }
- else
- {
- $this->confirm($execute=False);
- }
- }
-
- function confirm($execute='')
- {
- $link_data = array
- (
- 'execute' => $execute,
- );
-
- if(!$execute)
- {
- $lang_confirm_msg = 'Gå videre for å se
hva som blir lagt til';
- }
- else
- {
- $lang_confirm_msg = lang('kjør på');
- }
-
- $lang_yes = lang('yes');
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('confirm_custom'));
-
-
- $msgbox_data =
$GLOBALS['phpgw']->common->msgbox_data($this->receipt);
-
- $data = array
- (
- 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'done_action' =>
$GLOBALS['phpgw']->link('koble_bygg_gatetabell.php'),
- 'run_action' =>
$GLOBALS['phpgw']->link('koble_bygg_gatetabell.php',$link_data),
- 'message' =>
$this->receipt['message'],
- 'lang_confirm_msg' =>
$lang_confirm_msg,
- 'lang_yes' =>
$lang_yes,
- 'lang_yes_statustext' => 'Legg til manglende
gatenavn fra gatetabell',
- 'lang_no_statustext' => 'tilbake',
- 'lang_no' =>
lang('no'),
- 'lang_done' =>
'Avbryt',
- 'lang_done_statustext' => 'tilbake'
- );
-
- $appname = 'Legg til manglende gatenavn';
- $function_msg = '';
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('confirm' => $data));
- $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function execute($dry_run='',$cron='')
- {
-
- $street_list = $this->get_streets();
-
- $execute = false;
- if($dry_run)
- {
- _debug_array($street_list);
- $execute = true;
- }
- else
- {
- $this->update_location($street_list);
- }
- $this->confirm($execute);
-
-
- }
-
- function get_streets()
- {
- $this->db->query("SELECT id,descr as street_name from
fm_streetaddress",__LINE__,__FILE__);
- $location = array();
- while ($this->db->next_record())
- {
- $street_name =
$this->db->db_addslashes($this->db->f('street_name',true));
-
- $this->db2->query("SELECT location_code,
adresse from fm_location2 WHERE adresse ILIKE
'{$street_name}%'",__LINE__,__FILE__);
- while($this->db2->next_record())
- {
- $old_address =
$this->db2->f('adresse',true);
-
- $address_info = explode(' ',
$old_address);
- $a = count($address_info);
-
-
if(!ctype_digit(substr($address_info[$a-1],0,1)) ||
strrpos($address_info[$a-1], '/') || strrpos($address_info[$a-1], '(') ) //
ikkje gatenummer eller ikke entydig eller parantes...
- {
- continue;
- }
-
- $street_number = $address_info[$a-1];
-
- $location[] = array
- (
- 'location_code' =>
$this->db2->f('location_code'),
- 'old_address' =>
$old_address,
- 'street_id'
=> $this->db->f('id'),
- 'street_name' =>
$street_name,
- 'street_number' =>
$street_number,
- );
- }
- }
-
- return $location;
- }
-
- function update_location($street_list)
- {
- $i = 1;
- $this->db->transaction_begin();
- foreach($street_list as $entry)
- {
- $this->db->query("UPDATE fm_location2 set
street_id ='{$entry['street_id']}', street_number = '{$entry['street_number']}'
WHERE location_code = '{$entry['location_code']}' AND street_id IS
NULL",__LINE__,__FILE__);
- if( $this->db->affected_rows() )
- {
-
$this->receipt['message'][]=array('msg'=> "#{$i}: Gateadresse
{$entry['street_name']} {$entry['street_number']} oppdatert for
{$entry['location_code']}");
- $i++;
- }
- }
- $this->db->transaction_commit();
- }
- }
Deleted: branches/Version-1_0-branch/property/organize_pdf_BKB.php
===================================================================
--- branches/Version-1_0-branch/property/organize_pdf_BKB.php 2011-02-01
12:58:33 UTC (rev 6901)
+++ branches/Version-1_0-branch/property/organize_pdf_BKB.php 2011-02-01
12:59:53 UTC (rev 6902)
@@ -1,424 +0,0 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2010 Free Software Foundation, Inc.
http://www.fsf.org/
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
- * @package property
- * @subpackage custom
- * @version $Id$
- */
-
- /**
- * Description
- * @package property
- */
-
-
- $GLOBALS['phpgw_info']['flags'] = array
- (
- 'currentapp' => 'property'
- );
-
- include_once('../header.inc.php');
-
-
- if ( isset($GLOBALS['phpgw_info']['user']['apps']['admin']) )
- {
- $organize = new organize_pdf_bkb();
- $organize->pre_run();
- }
- else
- {
- echo 'go away';
- }
-
- class organize_pdf_bkb
- {
- /* In Admin->Property->Async servises:
- * Name: property.custom_functions.index
- * Data: function=organize_pdf,dir=C:/path/to/pdfs
- */
-
- protected $dir = '/opt/BK_Branntegninger_pdf';
-// protected $suffix = 'dwg';
- protected $suffix = 'pdf';
- protected $bypass = true; // bypass location check (only for
debugging)
- protected $cat_id = 17;
- protected $function_name = 'organize_pdf_BBE';
-
- function __construct()
- {
- $this->bocommon =
CreateObject('property.bocommon');
- $this->vfs =
CreateObject('phpgwapi.vfs');
- $this->rootdir = $this->vfs->basedir;
- $this->fakebase = $this->vfs->fakebase =
'/property';
- $this->db = & $GLOBALS['phpgw']->db;
- }
-
- function pre_run()
- {
- $confirm = get_var('confirm',array('POST'));
- $execute = get_var('execute',array('GET'));
- if(get_var('dir',array('GET')))
- {
- $this->dir = urldecode
(get_var('dir',array('GET')));
- }
- if(get_var('suffix',array('GET')))
- {
- $this->suffix = get_var('suffix',array('GET'));
- }
-
- if(!$execute)
- {
- $dry_run=True;
- }
-
- if ($confirm)
- {
- $this->execute($dry_run,$cron);
- }
- else
- {
- $this->confirm($execute=False);
- }
- }
-
- function confirm($execute='',$done='')
- {
-
- $link_data = array
- (
- 'execute' => $execute,
- 'dir' => $this->dir,
- 'suffix' => $this->suffix,
- );
-
- $lang_confirm_msg = '';
- if(!$done)
- {
- if(!$execute)
- {
- $lang_confirm_msg = 'Gå videre
for å se hva som blir lagt til';
- }
- else
- {
- $lang_confirm_msg = 'Vil du
virkelig utføre denne operasjonen';
- }
- }
-
- $lang_yes = lang('yes');
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('confirm_custom'));
-
- $msgbox_data =
$this->bocommon->msgbox_data($this->receipt);
-
- $data = array
- (
- 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'done_action' =>
$GLOBALS['phpgw']->link('organize_pdf_BKB.php'),
- 'run_action' =>
$GLOBALS['phpgw']->link('organize_pdf_BKB.php',$link_data),
- 'message' =>
$this->receipt['message'],
- 'lang_confirm_msg' =>
$lang_confirm_msg,
- 'lang_yes' =>
$lang_yes,
- 'lang_yes_statustext' => 'Organisere
tegninger i register og på disk',
- 'lang_no_statustext' => 'tilbake',
- 'lang_no' =>
lang('no'),
- 'lang_done' =>
'Avbryt',
- 'lang_done_statustext' => 'tilbake'
- );
-
- $appname = 'Organisere tegninger';
- $function_msg = 'Organisere tegninger i register og
på disk';
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('confirm' => $data));
- $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function execute($dry_run='',$cron='')
- {
- set_time_limit(1000);
-
- if(!is_dir("{$this->dir}/archive"))
- {
- if(!mkdir("{$this->dir}/archive"))
- {
-
$this->receipt['error'][]=array('msg'=>lang('failed to create directory') . "
:{$this->dir}/archive");
- $this->confirm('',true);
- return;
- }
- }
-
- $file_list = $this->get_files();
-
- if($dry_run)
- {
- $this->confirm($execute=True);
- _debug_array($file_list);
- }
- else
- {
- if ($file_list && isset($file_list['valid']))
- {
- foreach($file_list['valid'] as
$file_entry)
- {
-
$this->create_dir($file_entry['location_code']);
- $this->copy_file($file_entry);
- }
- }
- if(!$cron)
- {
-
$this->confirm($execute=false,$done=true);
- }
-
- $msgbox_data =
$this->bocommon->msgbox_data($this->receipt);
-
- $insert_values= array
- (
- $cron,
- date($this->bocommon->datetimeformat),
- $this->function_name,
- implode(',',(array_keys($msgbox_data)))
- );
-
- $insert_values =
$this->db->validate_insert($insert_values);
-
- $sql = "INSERT INTO fm_cron_log
(cron,cron_date,process,message) "
- . "VALUES ($insert_values)";
- $this->db->query($sql,__LINE__,__FILE__);
- }
- }
-
- function get_files()
- {
- $myfilearray = array();
-
- if(!is_dir($this->dir))
- {
- return $myfilearray;
- }
- $dir = new DirectoryIterator($this->dir);
-
- if ( is_object($dir) )
- {
- foreach ( $dir as $file )
- {
- if ( $file->isDot()
- || !$file->isFile()
- || !$file->isReadable()
- || strcasecmp( end( explode(
".", $file->getPathname() ) ), $this->suffix ) != 0 )
- {
- continue;
- }
- $file_name = $file->getFilename();
-
-
if($this->check_old_building($file_name))
- {
- $myfilearray['valid'][] = array
- (
- 'last_modified'=>
$file->getMTime(),
- 'file_name'=>
$file_name,
- 'file_path'=> (string)
"{$this->dir}/{$file_name}",
- 'tips_bygg'=>
substr($file_name, 0, 6),
- 'loc1'=>
$this->get_loc(substr($file_name, 0, 6)),
- 'loc2'=> $this->loc2,
- 'location_code' =>
$this->location_code,
- 'cat_id' =>
$this->cat_id,
- 'new_file_name'
=>str_replace(' Model (1)', '', $this->loc1 . $this->loc2 . (substr($file_name,
6, (strlen($file_name)-6)))),
- );
- }
- else
- {
- $myfilearray['rejected'][] =
array
- (
- 'file_name' =>
$file_name,
- 'strlen' =>
strlen($file_name),
- 'building' =>
$this->check_old_building($file_name)
- );
- }
- }
- }
-
- return $myfilearray;
- }
-
- function get_loc($file)
- {
- $tips_bygg = substr($file, 0, 6);
-
- $sql = "SELECT loc1,loc2 FROM fm_location2 WHERE
tips_bygg= '$tips_bygg'";
-
- $this->db->query($sql,__LINE__,__FILE__);
- $this->db->next_record();
- $this->loc1 = $this->db->f('loc1');
- $this->loc2 = $this->db->f('loc2');
- $this->location_code = $this->db->f('loc1') . '-'
.$this->db->f('loc2');
- return $this->db->f('loc1');
- }
-
-
- function check_old_building($file)
- {
- $tips_bygg = substr($file, 0, 6);
-
- $sql = "SELECT count(*) as cnt FROM fm_location2 WHERE
tips_bygg= '$tips_bygg'";
-
- $this->db->query($sql,__LINE__,__FILE__);
- $this->db->next_record();
- if($this->db->f('cnt'))
- {
- return True;
- }
- }
- function check_building($file)
- {
- $loc1 = substr($file, 0, 4);
- $loc2 = substr($file, 4, 2);
- $sql = "SELECT count(*) as cnt FROM fm_location2 WHERE
loc1= '$loc1' AND loc2= '$loc2'";
-
- $this->db->query($sql,__LINE__,__FILE__);
- $this->db->next_record();
- return !!$this->db->f('cnt');
- }
-
- function create_dir($location_code='')
- {
- $this->vfs->override_acl = 1;
-
- $dir = "{$this->fakebase}/document/{$location_code}";
-
- if(!$this->vfs->file_exists(array(
- 'string' => $dir,
- 'relatives' => Array(RELATIVE_NONE)
- )))
- {
- if(!$this->vfs->mkdir (array(
- 'string' => $dir,
- 'relatives' => array(
- RELATIVE_NONE
- )
- )))
- {
-
$this->receipt['error'][]=array('msg'=>lang('failed to create directory') . "
:{$dir}");
- }
- else
- {
-
$this->receipt['message'][]=array('msg'=>lang('directory created') . "
:{$dir}");
- }
- }
-
-
- $dir =
"{$this->fakebase}/document/{$location_code}/{$this->cat_id}";
- if(!$this->vfs->file_exists(array(
- 'string' => $dir,
- 'relatives' => Array(RELATIVE_NONE)
- )))
- {
- if(!$this->vfs->mkdir (array(
- 'string' => $dir,
- 'relatives' => array(
- RELATIVE_NONE
- )
- )))
- {
-
$this->receipt['error'][]=array('msg'=>lang('failed to create directory') . "
:{$dir}");
- }
- else
- {
-
$this->receipt['message'][]=array('msg'=>lang('directory created') . "
:{$dir}");
- }
- }
-
-
- $this->vfs->override_acl = 0;
- }
-
- function copy_file($values)
- {
- $to_new_file =
"{$this->fakebase}/document/{$values['location_code']}/{$this->cat_id}/{$values['new_file_name']}";
-
- $from_file = $values['file_path'];
-
- $this->db->transaction_begin();
-
- $this->vfs->override_acl = 1;
-
-
- if($this->vfs->file_exists(array(
- 'string' => $to_new_file,
- 'relatives' => Array(RELATIVE_NONE)
- )))
- {
-
$this->receipt['error'][]=array('msg'=>lang('File %1 already
exists!',$values['new_file_name']));
- }
- else
- {
- if(!$this->vfs->cp (array (
- 'from' => $from_file,
- 'to' => $to_new_file,
- 'relatives' => array
(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL))))
- {
-
$this->receipt['error'][]=array('msg'=>lang('Failed to copy file !') .
$values['new_file_name']);
- }
- else
- {
- $address =
$this->get_address($values['loc1'],$values['loc2'],$values['loc3']);
-
- $values['title'] = 'Branntegning - pdf';
-
- $insert_values= array(
- $values['new_file_name'],
- $values['title'],
- 'public',
- $values['cat_id'],
- time(),
- $values['last_modified'],
- 1,
- 6,
- 2,
- $values['location_code'],
- $address,
- $values['branch_id'],
- $values['vendor_id'],
- 6,
- $values['loc1'],
- $values['loc2']
- );
-
- $insert_values =
$this->db->validate_insert($insert_values);
-
- $sql = "INSERT INTO fm_document
(document_name,title,access,category,entry_date,document_date,version,coordinator,status,"
- .
"location_code,address,branch_id,vendor_id,user_id,loc1,loc2) "
- . "VALUES ($insert_values)";
-
-
$this->db->query($sql,__LINE__,__FILE__);
-
- $ok = rename($from_file,
"{$this->dir}/archive/{$values['file_name']}");
-
-
$this->receipt['message'][]=array('msg'=>lang('File %1
copied!',$values['new_file_name']));
-
$this->receipt['message'][]=array('msg'=>lang('File %1 moved!',$from_file));
- }
- }
-
- $this->db->transaction_commit();
- $this->vfs->override_acl = 0;
- }
-
- function get_address($loc1='',$loc2='')
- {
- if ($loc3)
- {
- $sql = "SELECT loc3_name as address FROM
fm_location3 WHERE loc1='$loc1' AND loc2='$loc2' AND loc3='$loc3'";
- }
- else
- {
- $sql = "SELECT loc2_name as address FROM
fm_location2 WHERE loc1='$loc1' AND loc2='$loc2'";
- }
-
- $this->db->query($sql,__LINE__,__FILE__);
- $this->db->next_record();
- return $this->db->f('address');
- }
- }
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [6902] Merge 6898:6901 from trunk,
Sigurd Nes <=