]> git.nbdom.net Git - nb.git/commitdiff
data
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Fri, 17 Jun 2016 01:11:43 +0000 (02:11 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Fri, 17 Jun 2016 01:11:43 +0000 (02:11 +0100)
etc/dbs/rent.php

index 67c2c8d50047910f343d76590283e1c761ff50ac..2b0c21d7f93b26d7964d1f0568e4eb984c8c8815 100644 (file)
@@ -11,18 +11,16 @@ $CONF['_rent'] = array(
   'tables' => array(
 
     'place' => array(
-      'replace' => array (
-        'id' => 'addr.addr',
-      ),
+      #'replace' => [ 'id' => 'addr.addr' ],
+      'row_parse_post' => 'place_doc',
+    ),
+    'tenant' => array(
+      'row_parse_post' => 'tenant_doc',
     ),
 
     'rent' => array(
       'orderby' => 'start desc, end desc',
-
-      'replace' => array (
-        'idtenant' => 'tenant.name',
-        'idplace' => 'addr.addr',
-      ),
+      #'replace' => [ 'idtenant' => 'tenant.name', 'idplace' => 'addr.addr' ],
 
       'row_parse_pre' => function(&$r) {
         $r['month'] = $r['rent'] + $r['charge'];
@@ -57,6 +55,14 @@ $CONF['_rent'] = array(
   ),
 );
 
+$CONF['rent'] = array (
+  'order' => 5,
+  'pdo' => 'sqlite:/opt/rent/rent.db',
+  #'_import' => '_nb',
+);
+
+return 1;
+
 function untilde($path) {
   if (!function_exists('posix_getuid')) return $path;
   return preg_replace_callback('/^(~)(\w+)?/',function($m){
@@ -69,6 +75,8 @@ 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;
+
   $url = '';
   foreach (['id'.$table,'id'] as $k) {
     if (isset($r[$k])) {
@@ -106,16 +114,4 @@ function rent_doc($table,&$r) {
 
 }
 
-#die(untilde('~/.gitconfig'));
-if (!empty($_SERVER['DOCUMENT_ROOT'])) {
-  $CONF['_rent']['tables']['tenant'] = [ 'row_parse_post' => 'tenant_doc' ];
-  $CONF['_rent']['tables']['place']['row_parse_post'] = 'place_doc';
-}
-
-$CONF['rent'] = array (
-  'order' => 5,
-  'pdo' => 'sqlite:/opt/rent/rent.db',
-  #'_import' => '_nb',
-);
-
 ?>