--- /dev/null
+<?php
+$CONF['puppetdb'] = array (
+ 'title' => 'Puppetdb',
+ 'host' => 'big',
+ 'type' => 'pgsql',
+ 'user' => 'puppetdb',
+ 'default_table' => 'view_hosts',
+ 'row_parse' => function(&$r) {
+ foreach ($r as $k=>$v) {
+ $r[$k] = preg_replace('/(:\d\d)\.\d+/','\1',$v);
+ }
+ },
+# NB 11.04.16 'tables' =>
+# NB 11.04.16 array (
+# NB 11.04.16 'hosts' =>
+# NB 11.04.16 array (
+# NB 11.04.16 'row_parse_pre' => function(&$r) {
+# NB 11.04.16 foreach ($r as $k=>$v) {
+# NB 11.04.16 $r[$k] = preg_replace('/(:\d\d)\.\d+/','\1',$v);
+# NB 11.04.16 }
+# NB 11.04.16 },
+# NB 11.04.16 ),
+# NB 11.04.16 ),
+);
+?>
--- /dev/null
+<?php
+$CONF['_rent'] = array (
+ 'Title' => 'Rent',
+ 'notice' => 'Micro foncier 4BE',
+ 'default_table' => 'rent',
+
+ 'tables' => array(
+
+ 'place' => array(
+ 'replace' => array (
+ 'id' => 'addr.addr',
+ ),
+ ),
+
+ 'rent' => array(
+ 'orderby' => 'start desc, end desc',
+
+ 'replace' => array (
+ 'idtenant' => 'tenant.name',
+ 'idplace' => 'addr.addr',
+ ),
+
+ 'row_parse_pre' => function(&$r) {
+ #extra: "rent * (1 + ( strftime('%m',end)+12*strftime('%Y',end) ) - ( strftime('%m',start)+12*strftime('%Y',start) ))"
+ #$r['rent_year'] = $r['rent'] * (1 + ( date('m',strtotime($r['end']))+12
+ $r['Total'] = $r['rent'] + $r['charge'];
+ if (1) $r['rent_year'] = sprintf('%.2f',$r['rent'] * (1 +
+ ( date('m',strtotime($r['end'])) + 12 * date('Y',strtotime($r['end'])) )
+ -
+ ( date('m',strtotime($r['start'])) + 12 * date('Y',strtotime($r['start'])) )
+ ));
+ },
+
+ 'row_parse_post' => ((empty($GLOBALS['Db']) or 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 href="template/?id='.$t[0].'&idplace=:idplace&idtenant=:idtenant&start=:start">'.preg_replace('/\.\w+$/','',$t[0]).'</a>';
+ }
+ }
+
+ $r['revision'] = '';
+ foreach ($templates as $t) {
+ $r['revision'] .= preg_replace_callback('/:(\w+)/',function($m) use(&$r) {return $r[$m[1]];},$t).' ';
+ }
+ $r['revision'] = trim($r['revision']);
+
+ }),
+ ),
+
+ ),
+);
+
+$CONF['rent'] = array (
+ 'order' => 1,
+ 'pdo' => 'sqlite:/opt/rent/rent.db',
+ '_import' => '_rent',
+);
+
+?>