From 6e52498b1aaa859647ba9ead382f13cab8c24bbc Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Fri, 20 Jan 2017 00:34:37 +0000 Subject: [PATCH] delete etc/dbq/PERSO --- etc/dbq/nb.php | 116 ------------------------------------------------- 1 file changed, 116 deletions(-) delete mode 100644 etc/dbq/nb.php diff --git a/etc/dbq/nb.php b/etc/dbq/nb.php deleted file mode 100644 index 9ebe16c6..00000000 --- a/etc/dbq/nb.php +++ /dev/null @@ -1,116 +0,0 @@ - 'db.nbdom.net', - 'host' => '192.168.3.1', - 'type' => 'mysql', - 'name' => 'nb', - '_import' => ['_nico'], - - 'title' => 'Nb', - 'notice' => 'Micro foncier 4BE', - 'default_table' => 'rent', - - 'tables' => array( - - 'agency' => [ 'row_parse_post' => function(&$r) { return rent_doc('agency',$r); }, ], - - 'place' => [ - #'replace' => [ 'id' => 'addr.addr' ], - 'row_parse_post' => 'place_doc', - ], - - 'tenant' => [ - 'row_parse_post' => 'tenant_doc', - ], - - 'test' => [ - 'sql' => "SELECT 'Test sql table' as Test", - ], - - 'rent' => [ - 'orderby' => 'start desc, end desc', - #'replace' => [ 'idtenant' => 'tenant.name', 'idplace' => 'addr.addr' ], - - 'row_parse_pre' => function(&$r) { - $r['month'] = $r['rent'] + $r['charge']; - - $start_month = date('m',strtotime($r['start'])); - $end_month = date('m',strtotime($r['end'])); - if (date('Y',strtotime($r['end'])) > date('Y',strtotime($r['start']))) $end_month = 12; - $r['months'] = (1 + $end_month - $start_month); - - $r['total'] = sprintf('%d',$r['rent'] * $r['months']); - }, - - 'row_parse_post' => (Db::php_cli() ? null : function(&$r) { - static $templates; - if (!isset($templates)) { - $templates = $GLOBALS['Db']->rows("SELECT id FROM template",PDO::FETCH_NUM); - foreach ($templates as $k=>$t) { - $templates[$k] = ''.preg_replace('/\.\w+$/','',$t[0]).''; - } - } - - tenant_doc($r); - $revision = ''; - foreach ($templates as $t) { - $revision .= preg_replace_callback('/:(\w+)/',function($m) use(&$r) {return $r[$m[1]];},$t).' '; - } - $r['doc'] = preg_replace('@^(?:]+>)?(.*?)(?:)?$@','
'.trim($revision).'\1
',$r['doc']); - - }), - ], - - ), -]; - -if (strpos(php_uname("n"),'ovh.net')!==false) $DBQ['nb']['order'] = 1; -return 1; - -function tenant_doc(&$r) { return rent_doc('tenant',$r); } -function place_doc(&$r) { return rent_doc('place',$r); } - -function rent_doc($table,&$r) { - if (empty($_SERVER['DOCUMENT_ROOT'])) return; - - #if (!empty($r['end']) and date('Ymd') > $r['end']) return $r['doc'] = isset($r['doc']) ? $r['doc'] : ''; - - $url = ''; - foreach (['id'.$table,'id'] as $k) { - if (isset($r[$k])) { - $url = '/data/'.$table.'/'.$r[$k]; - break; - } - } - if (!$url) return; - - if (!isset($r['doc'])) $r['doc'] = ''; -#debug($_SERVER['DOCUMENT_ROOT'].$url); - if ( - - # Web url - ( - empty($r['doc']) and file_exists( $dir = $_SERVER['DOCUMENT_ROOT'].$url ) - ) - - # Absolute path - or ( - ( $dir = nb::untilde($r['doc']) ) - and file_exists($dir) and is_dir($dir) - and ($url='' or 1) - ) - - ) { - - foreach (nb::ls_dir($dir,'',true) as $p) { - $r['doc'] .= sprintf('%s ',"$url/$p", - nb::prettyText(preg_replace('@^.*?([^/\.]+).*?$@','\1',$p)) - ); - } - - } - - if (!empty($r['doc'])) $r['doc'] = '
'.$r['doc'].'
'; -} -?> -- 2.47.3