From: x2000habouzit Date: Sun, 30 Jul 2006 10:39:48 +0000 (+0000) Subject: drop trezo module. X-Git-Tag: xorg/0.9.11~205 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=7cef7ea815d291f19f10249eaaf7ad736f92e9c7;p=platal.git drop trezo module. MUST DO A BACKUP BEFORE UPGRADE git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@709 839d8a87-29fc-0310-9880-83ba4fa771e5 --- diff --git a/htdocs/index.php b/htdocs/index.php index 881a223..7ab8a67 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -26,7 +26,7 @@ require_once dirname(__FILE__).'/../classes/PLModule.php'; $platal = new Platal('auth', 'banana', 'carnet', 'email', 'events', 'geoloc', 'lists', 'marketing', 'payment', 'platal', 'profile', - 'register', 'search', 'stats', 'trezo', 'admin'); + 'register', 'search', 'stats', 'admin'); $platal->run(); ?> diff --git a/include/money/trezo.inc.php b/include/money/trezo.inc.php deleted file mode 100644 index 624bd61..0000000 --- a/include/money/trezo.inc.php +++ /dev/null @@ -1,63 +0,0 @@ -'Janvier', - '02'=>'Février', - '03'=>'Mars', - '04'=>'Avril', - '05'=>'Mai', - '06'=>'Juin', - 'O7'=>'Juillet', - '08'=>'Août', - '09'=>'Septembre', - '10'=>'Octobre', - '11'=>'Novembre', - '12'=>'Decembre'); - - -$trim_fr = array('01'=>'Janvier-Mars', - '04'=>'Avril-Juin', - '07'=>'Juillet-Septembre', - '10'=>'Octobre-Decembre'); - - -function isDate($date) -{ - list($d, $m, $y) = split('[/.-]', $date); - $dummy = date("d/m/Y", mktime (0,0,0,$m,$d,$y)); - $date = ereg_replace('-', '/', $date); - return ($dummy == $date); -} - - -function solde_until($date='') -{ - $sql = "SELECT SUM(credit)-SUM(debit) FROM money_trezo"; - if (empty($date)) { - $res = XDB::query($sql); - } else { - $res = XDB::query($sql." WHERE date <= {?}", $date); - } - return $res->fetchOneCell(); -} - -?> diff --git a/modules/trezo.php b/modules/trezo.php deleted file mode 100644 index 6181ce0..0000000 --- a/modules/trezo.php +++ /dev/null @@ -1,143 +0,0 @@ - $this->make_hook('default', AUTH_COOKIE), - 'trezo/ops' => $this->make_hook('operation', AUTH_COOKIE), - ); - } - - function handler_default(&$page) - { - $page->changeTpl('trezo/index.tpl'); - - require_once 'money/trezo.inc.php'; - - //table operations : - //+--------+---------------+------+-----+------------+----------------+ - //| field | type | null | key | default | extra | - //+--------+---------------+------+-----+------------+----------------+ - //| id | int(11) | | pri | null | auto_increment | - //| date | date | | | 0000-00-00 | | - //| label | varchar(80) | | | | | - //| credit | decimal(10,2) | | | 0.00 | | - //| debit | decimal(10,2) | | | 0.00 | | - //+--------+---------------+------+-----+------------+----------------+ - - $annee_sel = Env::v('annee', date('y')); - $mois_sel = Env::v('mois', sprintf('%02u', date('m') - (intval(date('m') - 1) % 3))); - - $mois_sel_fin = sprintf('%02u',$mois_sel + 2); - $from_date = "$annee_sel-$mois_sel-01"; - $to_date = "$annee_sel-$mois_sel_fin-31"; - $mon_sel = $trim_fr[$mois_sel]." $annee_sel"; - - $page->assign('from_solde', solde_until($from_date)); - $page->assign('to_solde', solde_until($to_date)); - $page->assign('annee_sel', $annee_sel); - $page->assign('mois_sel', $mois_sel); - $page->assign('mon_sel', $mon_sel); - $page->assign_by_ref('month_arr', $trim_fr); - - $page->assign('ops', XDB::iterator( - "SELECT date, label, credit, debit - FROM money_trezo WHERE date >= {?} and date <= {?} order by date", - $from_date, $to_date)); - } - - function handler_operation(&$page) - { - $page->changeTpl('trezo/gere_operations.tpl'); - - require_once 'money/trezo.inc.php'; - - $page->assign('xorg_title','Polytechnique.org - Administration - Trezo : gestion'); - - $action = clean_request('action'); - $op_id = clean_request('op_id'); - $op_date = clean_request('op_date'); - $op_label = clean_request('op_label'); - $op_credit = clean_request('op_credit'); - $op_debit = clean_request('op_debit'); - - $annee_sel = isset($_REQUEST['annee']) ? $_REQUEST['annee'] : date("Y"); - $mois_sel = isset($_REQUEST['mois']) ? $_REQUEST['mois'] : sprintf("%02u", date('m')); - - $from_date = "$annee_sel-$mois_sel-01"; - $to_date = "$annee_sel-$mois_sel-31"; - $mon_sel = $trim_fr[$mois_sel]." $annee_sel"; - - switch($action) { - case "edit": - if ($op_id) { - $res = XDB::query("SELECT date,label,credit,debit FROM money_trezo WHERE id={?}", $op_id); - list($op_date,$op_label,$op_credit,$op_debit) = $res->fetchOneRow(); - } - break; - - case "update": - if (isDate($op_date)){ - $mydatefr = explode("/",$op_date); - $mydate = $mydatefr[2]."-".$mydatefr[1]."-".$mydatefr[0]; - } else { - $mydate = date("Y-m-d"); - } - - $sql = "replace into money_trezo set date='$mydate',label='".addslashes($op_label)."'"; - - if ($op_credit) { $sql .= ',credit='.$op_credit; } - if ($op_debit) { $sql .= ',debit='.$op_debit; } - if ($op_id) { $sql .= ",id='$op_id'"; } - - XDB::execute($sql); - break; - - case "del": - if ($op_id) { - XDB::execute("DELETE FROM money_trezo WHERE id={?}", $op_id); - } - break; - } - - $page->assign('op_id', $op_id); - $page->assign('annee_sel', $annee_sel); - $page->assign('mois_sel', $mois_sel); - $page->assign('op_date', $op_date); - $page->assign('op_label', $op_label); - $page->assign('op_debit', $op_debit); - $page->assign('op_credit', $op_credit); - $page->assign('mon_sel', $mon_sel); - - $page->assign('from_solde', solde_until($from_date)); - $page->assign('to_solde', solde_until($to_date)); - $page->assign('month_arr', $mois_fr); - $page->assign('ops', XDB::iterator( - "SELECT id, date, label, credit, debit FROM money_trezo - WHERE date >= {?} and date <= {?} ORDER BY date", - $from_date, $to_date)); - } -} - -?> diff --git a/templates/admin/index.tpl b/templates/admin/index.tpl index 5abbc8a..80286d1 100644 --- a/templates/admin/index.tpl +++ b/templates/admin/index.tpl @@ -113,8 +113,6 @@ Trésorerie :   - Comptes -   |   Paiements