]> git.nbdom.net Git - nb.git/commitdiff
delete etc/dbq/PERSO
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Fri, 20 Jan 2017 00:34:37 +0000 (00:34 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Fri, 20 Jan 2017 00:34:37 +0000 (00:34 +0000)
etc/dbq/nb.php [deleted file]

diff --git a/etc/dbq/nb.php b/etc/dbq/nb.php
deleted file mode 100644 (file)
index 9ebe16c..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-<?php
-
-$DBQ['nb'] = [
-  #'host' => '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] = '<a class="small revision" href="template/?id='.$t[0].'&amp;idplace=:idplace&amp;idtenant=:idtenant&amp;start=:start">'.preg_replace('/\.\w+$/','',$t[0]).'</a>';
-          }
-        }
-
-        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('@^(?:<div[^>]+>)?(.*?)(?:</div>)?$@','<div class="list">'.trim($revision).'\1</div>',$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('<a href="%s" class="small">%s</a> ',"$url/$p",
-        nb::prettyText(preg_replace('@^.*?([^/\.]+).*?$@','\1',$p))
-      );
-    }
-
-  }
-
-  if (!empty($r['doc'])) $r['doc'] = '<div class="list">'.$r['doc'].'</div>';
-}
-?>