tutos-commits Mailing List for TUTOS
Projects / CRM / PLM / Calendar / Tasks / SCRUM / Test / Inventory
Brought to you by:
gokohnert
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(13) |
Aug
(214) |
Sep
(144) |
Oct
(22) |
Nov
(22) |
Dec
(93) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(25) |
Feb
(31) |
Mar
(92) |
Apr
(70) |
May
(103) |
Jun
(130) |
Jul
(265) |
Aug
(325) |
Sep
(233) |
Oct
(244) |
Nov
(261) |
Dec
(157) |
2003 |
Jan
(101) |
Feb
(135) |
Mar
(148) |
Apr
(164) |
May
(53) |
Jun
(116) |
Jul
(149) |
Aug
(126) |
Sep
(45) |
Oct
(109) |
Nov
(36) |
Dec
(61) |
2004 |
Jan
(131) |
Feb
(236) |
Mar
(278) |
Apr
(259) |
May
(92) |
Jun
(110) |
Jul
(150) |
Aug
(64) |
Sep
(141) |
Oct
(141) |
Nov
(146) |
Dec
(65) |
2005 |
Jan
(70) |
Feb
(77) |
Mar
(129) |
Apr
(153) |
May
(161) |
Jun
(63) |
Jul
(42) |
Aug
(16) |
Sep
(30) |
Oct
(3) |
Nov
(8) |
Dec
(40) |
2006 |
Jan
(114) |
Feb
(16) |
Mar
(12) |
Apr
(15) |
May
(4) |
Jun
(9) |
Jul
(69) |
Aug
(27) |
Sep
(12) |
Oct
(80) |
Nov
(62) |
Dec
(41) |
2007 |
Jan
(34) |
Feb
(2) |
Mar
(38) |
Apr
(82) |
May
(61) |
Jun
(37) |
Jul
(16) |
Aug
(64) |
Sep
(7) |
Oct
(52) |
Nov
(18) |
Dec
(28) |
2008 |
Jan
(168) |
Feb
(26) |
Mar
(27) |
Apr
(19) |
May
(10) |
Jun
(58) |
Jul
(58) |
Aug
(91) |
Sep
(14) |
Oct
(23) |
Nov
(56) |
Dec
(38) |
2009 |
Jan
(58) |
Feb
(90) |
Mar
(204) |
Apr
(90) |
May
(27) |
Jun
(177) |
Jul
(116) |
Aug
(53) |
Sep
(42) |
Oct
(120) |
Nov
(51) |
Dec
(58) |
2010 |
Jan
(117) |
Feb
(231) |
Mar
(163) |
Apr
(90) |
May
(40) |
Jun
(139) |
Jul
(49) |
Aug
(118) |
Sep
(25) |
Oct
(80) |
Nov
(102) |
Dec
(99) |
2011 |
Jan
(176) |
Feb
(42) |
Mar
(60) |
Apr
(52) |
May
(30) |
Jun
(29) |
Jul
(27) |
Aug
(16) |
Sep
(51) |
Oct
(70) |
Nov
(63) |
Dec
(58) |
2012 |
Jan
(28) |
Feb
(26) |
Mar
(7) |
Apr
(12) |
May
(41) |
Jun
(61) |
Jul
(59) |
Aug
(38) |
Sep
(30) |
Oct
(28) |
Nov
(14) |
Dec
(31) |
2013 |
Jan
(24) |
Feb
(54) |
Mar
(45) |
Apr
(22) |
May
(35) |
Jun
(8) |
Jul
(18) |
Aug
(38) |
Sep
(11) |
Oct
(8) |
Nov
(19) |
Dec
(20) |
2014 |
Jan
(20) |
Feb
(22) |
Mar
(4) |
Apr
(6) |
May
(13) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(6) |
2015 |
Jan
|
Feb
(1) |
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(1) |
2016 |
Jan
(4) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
(2) |
Aug
(4) |
Sep
(1) |
Oct
(1) |
Nov
(1) |
Dec
|
2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
(8) |
Aug
(13) |
Sep
(12) |
Oct
|
Nov
|
Dec
|
2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
2021 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
|
|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
(4) |
9
|
10
|
11
|
12
|
13
|
14
|
15
|
16
|
17
|
18
|
19
|
20
|
21
|
22
|
23
|
24
|
25
|
26
|
27
|
28
(2) |
29
|
30
|
31
(2) |
|
|
|
|
|
From: <gok...@us...> - 2017-07-31 14:49:09
|
Revision: 1310 http://sourceforge.net/p/tutos/code/1310 Author: gokohnert Date: 2017-07-31 14:49:07 +0000 (Mon, 31 Jul 2017) Log Message: ----------- new feature to couple a expense state to bug state for tracking. use expense config to enable this (auto_track) Modified Paths: -------------- trunk/html/nuke.css Modified: trunk/html/nuke.css =================================================================== --- trunk/html/nuke.css 2017-07-31 14:35:54 UTC (rev 1309) +++ trunk/html/nuke.css 2017-07-31 14:49:07 UTC (rev 1310) @@ -113,7 +113,7 @@ color: black; white-space: normal; min-width: 10em; - max-width: 14em; + max-width: 16em; } .pagetitle { @@ -578,4 +578,4 @@ background: #ffff72; outline: 0; } -/* EOF */ \ No newline at end of file +/* EOF */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gok...@us...> - 2017-07-31 14:35:56
|
Revision: 1309 http://sourceforge.net/p/tutos/code/1309 Author: gokohnert Date: 2017-07-31 14:35:54 +0000 (Mon, 31 Jul 2017) Log Message: ----------- new feature to couple a expense state to bug state for tracking. use expense config to enable this (auto_track) Modified Paths: -------------- trunk/php/base.pinc trunk/php/db/table_custom_example.pinc trunk/php/expense/de.p3 trunk/php/expense/en.p3 trunk/php/expense/expense.pinc trunk/php/expense/expense_config.php trunk/php/expense/expense_ins.php trunk/php/expense/expense_overview.php trunk/php/expense/fr.p3 trunk/php/expense/hu.p3 trunk/php/expense/mconfig.pinc trunk/php/expense/tw.p3 trunk/php/expense/zh.p3 trunk/php/watchlist/watchlist.pinc Modified: trunk/php/base.pinc =================================================================== --- trunk/php/base.pinc 2017-07-28 13:53:13 UTC (rev 1308) +++ trunk/php/base.pinc 2017-07-31 14:35:54 UTC (rev 1309) @@ -1,6 +1,6 @@ <?php /** - * Copyright 2002 - 2013 by Gero Kohnert + * Copyright 2002 - 2017 by Gero Kohnert * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -2077,5 +2077,14 @@ function cache_store($id,$value,$ttl = -1) { return $this->cache_store_static($this->dbconn->db->systemid.$id,$value,$ttl); } + + /** + * trigger object + * use for inter object communication + * returns a text message + */ + function trigger(tutos_base $obj,$message) { + return ''; + } } ?> \ No newline at end of file Modified: trunk/php/db/table_custom_example.pinc =================================================================== --- trunk/php/db/table_custom_example.pinc 2017-07-28 13:53:13 UTC (rev 1308) +++ trunk/php/db/table_custom_example.pinc 2017-07-31 14:35:54 UTC (rev 1309) @@ -443,4 +443,18 @@ $table['appointment1']['description'][size] = 101; $table['appointment1']['visitor']['searchable'] = true; +$table['location']['iban'] = array('custom' => true, + type => "VARCHAR", + size => 200, + constraints => "", + Desc => "IBAN", + 'lang' => "IBAN", + 'handler' => "url", + 'overview' => false, # show in overview + 'sortable' => false, # show in overview as sortable + 'hideempty' => true, + 'required' => false + ); +$table['location']['acc_info1']['hideempty'] = true; + ?> \ No newline at end of file Modified: trunk/php/expense/de.p3 =================================================================== --- trunk/php/expense/de.p3 2017-07-28 13:53:13 UTC (rev 1308) +++ trunk/php/expense/de.p3 2017-07-31 14:35:54 UTC (rev 1309) @@ -88,6 +88,16 @@ $lang['ExpenseStates'][6] = 'in Vorbereitung'; $lang['ExpenseStates'][0] = 'undefiniert'; +$lang['ExpenseConfigHelpStateSTC'] = 'STC state support for expense states'; +$lang['ExpenseConfigHelpTrack'] = 'use a tracker object to support the allow/deny proess'; +$lang['ExpenseConfigHelpInitTrackStates'] = 'States that automatically trigger a tracker object'; +$lang['ExpenseConfigHelpAutoAllowState'] = 'State to enter automatically for allow'; +$lang['ExpenseConfigHelpBugAllowStates'] = 'bug states that trigger a automatic allow'; +$lang['ExpenseConfigHelpAutoDenyState'] = 'State to enter automatically for deny'; +$lang['ExpenseConfigHelpBugDenyStates'] = 'bug states that trigger a automatic deny'; +$lang['ExpenseConfigHelpBugInitialState'] = 'intial state for newly created tracker object'; +$lang['ExpenseConfigHelpBugSolver'] = 'Solver Adress or Team'; + $lang['perm'][useexpenses] = 'Spesennutzung'; $lang['expense'] = &$lang['Expense']; Modified: trunk/php/expense/en.p3 =================================================================== --- trunk/php/expense/en.p3 2017-07-28 13:53:13 UTC (rev 1308) +++ trunk/php/expense/en.p3 2017-07-31 14:35:54 UTC (rev 1309) @@ -88,6 +88,16 @@ $lang['ExpenseStates'][6] = 'prepare'; $lang['ExpenseStates'][0] = 'undefined'; +$lang['ExpenseConfigHelpStateSTC'] = 'STC state support for expense states'; +$lang['ExpenseConfigHelpTrack'] = 'use a tracker object to support the allow/deny proess'; +$lang['ExpenseConfigHelpInitTrackStates'] = 'States that automatically trigger a tracker object'; +$lang['ExpenseConfigHelpAutoAllowState'] = 'State to enter automatically for allow'; +$lang['ExpenseConfigHelpBugAllowStates'] = 'bug states that trigger a automatic allow'; +$lang['ExpenseConfigHelpAutoDenyState'] = 'State to enter automatically for deny'; +$lang['ExpenseConfigHelpBugDenyStates'] = 'bug states that trigger a automatic deny'; +$lang['ExpenseConfigHelpBugInitialState'] = 'intial state for newly created tracker object'; +$lang['ExpenseConfigHelpBugSolver'] = 'Solver Adress or Team'; + $lang['perm'][useexpenses] = 'use expenses'; $lang['expense'] = &$lang['Expense']; Modified: trunk/php/expense/expense.pinc =================================================================== --- trunk/php/expense/expense.pinc 2017-07-28 13:53:13 UTC (rev 1308) +++ trunk/php/expense/expense.pinc 2017-07-31 14:35:54 UTC (rev 1309) @@ -16,9 +16,43 @@ define ('EXPENSE_STATE_DONE',3); define ('EXPENSE_STATE_PAYED',4); define ('EXPENSE_STATE_REJECT',5); +define ('EXPENSE_STATE_PREPARE',6); define ('EXPENSE_STATE_UNDEF',0); // old expenses befire using states +/** + * make a bug when state changes to a trigger state + * called as postsave hook for the expense + */ +function expense_make_bug(tutos_base $obj) { + global $tutos; + + if (! in_array($obj->id,$tutos['expense_make_bug'])) return ' not in list '; + + $msg = ''; + // create a new bug + $solver = getObject($obj->dbconn,$tutos['expense_bug_solver']); + + $b = new bug($obj->dbconn); + $b->setParent($obj); + $b->setShort('Expense needs allow'); + $b->setName('auto'); + $b->setClass(BUG_CLASS_LIGHT); + $b->setState($tutos['expense_bug_initial_state']); + $b->setSolver($solver); + $b->bughist[0] = new bugdata($obj->dbconn); + $b->bughist[0]->description = myentities(wordwrap($obj->description,80)); + + $b->acl_raise($obj->adr_id,$tutos[useok]); + $msg = addLine($msg,$b->save()); + + // also set to watchlist + $w = new watchlist($obj->dbconn); + $msg = addLine($msg,$w->add($b->id,$obj->id,'inform about states')); + + return $msg; +} + /* --------------------------------------------------------------------------- * List all expenses * cols > 0 make sperate rows with cols columns for each expense @@ -600,7 +634,20 @@ * set the state */ function setState($value) { - return $this->setIntField("state",$value,"ExpenseState"); + global $tutos; + + + $changed = $this->setIntField("state",$value,"ExpenseState"); + if ($tutos['expense_auto_track'] == 1) { + $x = preg_split('#,#',$tutos['expense_init_track_states']); + if ($changed && in_array($value,$x)) { + // when saving trigger a bug if state is in list of trigger states + // use postsave hook + $tutos['expense_make_bug'][] = $this->id; + $tutos['postsave-hooks']['expense'][] = 'expense_make_bug'; + } + } + return $changed; } /** @@ -1066,6 +1113,40 @@ return $x; } + /** + * expense was triggered + * assigned bug might have been changed + * + */ + function trigger(tutos_base $obj,$message) { + global $tutos; + + $msg = ''; + if ($message != 'change') return ''; + if ($tutos['expense_auto_track'] != 1) return ''; + if ($obj->getType() != 'bugtracking') return ''; + + foreach ($obj->modified as $i => $f) { + if ($f['field'] == 'BugState') { + $allow = preg_split('#,#',$tutos['expense_bug_allow_states']); + $deny = preg_split('#,#',$tutos['expense_bug_deny_states']); + if (in_array($f['new'],$allow)) { + $msg = addLine($msg,$this->getLink(). ' allow '); + $this->setState($tutos['expense_auto_allow_state']); + $msg = addLine($msg,$this->save()); + } else if (in_array($f['new'],$deny)) { + $msg = addLine($msg,$this->getLink(). ' deny '); + $this->setState($tutos['expense_auto_deny_state']); + $msg = addLine($msg,$this->save()); + } + } + } + if ($msg != '') { + $msg = addLine('Expense:'. $this->getFullName(). ' was triggered by:'. $obj.' with '. $message,$msg); + } + return $msg; + } + /* --------------------------------------------------------------------------- * The following methods are abstract factory functions for groups * which handle the membership list of an object Modified: trunk/php/expense/expense_config.php =================================================================== --- trunk/php/expense/expense_config.php 2017-07-28 13:53:13 UTC (rev 1308) +++ trunk/php/expense/expense_config.php 2017-07-31 14:35:54 UTC (rev 1309) @@ -56,44 +56,126 @@ $r .= '<td colspan="2" class="pre">'.myentities($lang['ExpenseConfigHelpStateSTC']).'</td>'; $r .= $this->OverviewRowEnd($line++); - - // states that are like closed - $r .= $this->OverviewRowStart($line); - $r .= $this->showfield('expense_closed_states'); $stc = getObject($this->user->dbconn,$tutos['expense_state_stc']); if (!is_object($stc)) { $stc = new stc(null); $stc->initByArray('ExpenseStates',null); } - $x = preg_split('#,#',$tutos['expense_closed_states']); - $r .= '<td><select multiple="multiple" name="closed_states[]">'."\n"; - foreach ($stc->states as $f) { - $r .= ' <option value="'. $f->stc_state .'" style="background:'.$f->color.'"'; - if (in_array($f->stc_state,$x)) { - $r .= ' selected="selected"'; + + if ($tutos[usebugtracking] == 1) { + $bstc = getObject($this->user->dbconn,$tutos['bug_state_stc']); + if (!is_object($bstc)) { + $bstc = new stc(null); + $bstc->initByArray('BugStates',null); } - $r .= '>'. myentities($f->getFullName()) ."</option>\n"; - } - $r .= '</select></td>'; - $r .= '<td colspan="2" class="pre">'.$lang['ExpenseConfigHelpClosedStates'].'</td>'; - $r .= $this->OverviewRowEnd($line++); + // track the allow/deny by a bug object + $r .= $this->OverviewRowStart($line); + $r .= $this->showfield('expense_auto_track'); + $r .= '<td><input type="checkbox" name="auto_track"'.($tutos['expense_auto_track'] == 1 ? ' checked="checked"':'').' value="1" /></td>'; + $r .= '<td colspan="2" class="pre">'.$lang['ExpenseConfigHelpTrack'].'</td>'; + $r .= $this->OverviewRowEnd($line++); - // state to set on auto finish - $r .= $this->OverviewRowStart($line); - $r .= $this->showfield('expense_finish_state'); - $r .= '<td><select name="finish_state">'."\n"; - foreach ($stc->states as $f) { - $r .= ' <option value="'. $f->stc_state .'" style="background:'.$f->color.'"'; - if ($f->stc_state == $tutos['expense_finish_state']) { - $r .= ' selected="selected"'; + // states to initialize tracking + $r .= $this->OverviewRowStart($line); + $r .= $this->showfield('expense_init_track_states'); + $r .= '<td><select multiple="multiple" name="init_track_states[]">'; + $x = preg_split('#,#',$tutos['expense_init_track_states']); + foreach ($stc->states as $f) { + $r .= ' <option value="'. $f->stc_state .'" style="background:'.$f->color.'"'; + if (in_array($f->stc_state,$x)) { + $r .= ' selected="selected"'; + } + $r .= '>'. myentities($f->getFullName()) ."</option>\n"; } - $r .= '>'. myentities($f->getFullName()) ."</option>\n"; + $r .= '</select></td>'; + $r .= '<td colspan="2" class="pre">'.$lang['ExpenseConfigHelpInitTrackStates'].'</td>'; + $r .= $this->OverviewRowEnd($line++); + + // auto allow state + $r .= $this->OverviewRowStart($line); + $r .= $this->showfield('expense_auto_allow_state'); + $r .= '<td><select name="auto_allow_state">'; + foreach ($stc->states as $f) { + $r .= ' <option value="'. $f->stc_state .'" style="background:'.$f->color.'"'; + if ($f->stc_state == $tutos['expense_auto_allow_state']) { + $r .= ' selected="selected"'; + } + $r .= '>'. myentities($f->getFullName()) ."</option>\n"; + } + $r .= '</select></td>'; + $r .= '<td colspan="2" class="pre">'.$lang['ExpenseConfigHelpAutoAllowState'].'</td>'; + $r .= $this->OverviewRowEnd($line++); + + // bug states for changeing automtically to allow + $r .= $this->OverviewRowStart($line); + $r .= $this->showfield('expense_bug_allow_states'); + $r .= '<td><select multiple="multiple" name="bug_allow_states[]">'; + $x = preg_split('#,#',$tutos['expense_bug_allow_states']); + foreach ($bstc->states as $f) { + $r .= ' <option value="'. $f->stc_state .'" style="background:'.$f->color.'"'; + if (in_array($f->stc_state,$x)) { + $r .= ' selected="selected"'; + } + $r .= '>'. myentities($f->getFullName()) ."</option>\n"; + } + $r .= '</select></td>'; + $r .= '<td colspan="2" class="pre">'.$lang['ExpenseConfigHelpBugAllowStates'].'</td>'; + $r .= $this->OverviewRowEnd($line++); + + // auto allow state + $r .= $this->OverviewRowStart($line); + $r .= $this->showfield('expense_auto_deny_state'); + $r .= '<td><select name="auto_deny_state">'; + foreach ($stc->states as $f) { + $r .= ' <option value="'. $f->stc_state .'" style="background:'.$f->color.'"'; + if ($f->stc_state == $tutos['expense_auto_deny_state']) { + $r .= ' selected="selected"'; + } + $r .= '>'. myentities($f->getFullName()) ."</option>\n"; + } + $r .= '<td colspan="2" class="pre">'.$lang['ExpenseConfigHelpAutoDenyState'].'</td>'; + $r .= $this->OverviewRowEnd($line++); + + // bug states for changeing automatically to deny + $r .= $this->OverviewRowStart($line); + $r .= $this->showfield('expense_bug_deny_states'); + $r .= '<td><select multiple="multiple" name="bug_deny_states[]">'; + $x = preg_split('#,#',$tutos['expense_bug_deny_states']); + foreach ($bstc->states as $f) { + $r .= ' <option value="'. $f->stc_state .'" style="background:'.$f->color.'"'; + if (in_array($f->stc_state,$x)) { + $r .= ' selected="selected"'; + } + $r .= '>'. myentities($f->getFullName()) ."</option>\n"; + } + $r .= '</select></td>'; + $r .= '<td colspan="2" class="pre">'.$lang['ExpenseConfigHelpBugDenyStates'].'</td>'; + $r .= $this->OverviewRowEnd($line++); + + // inital bug state + $r .= $this->OverviewRowStart($line); + $r .= $this->showfield('expense_bug_inital_state'); + $r .= '<td><select name="bug_initial_state">'; + foreach ($bstc->states as $f) { + $r .= ' <option value="'. $f->stc_state .'" style="background:'.$f->color.'"'; + if ($f->stc_state == $tutos['expense_bug_initial_state']) { + $r .= ' selected="selected"'; + } + $r .= '>'. myentities($f->getFullName()) ."</option>\n"; + } + $r .= '<td colspan="2" class="pre">'.$lang['ExpenseConfigHelpBugInitialState'].'</td>'; + $r .= $this->OverviewRowEnd($line++); + + // bug solver + $r .= $this->OverviewRowStart($line); + $r .= $this->showfield('expense_bug_solver'); + $r .= '<td>'; + $r .= select_from_array_or_input($this->solver,"bug_solver",$this->solver,1,'at'); + $r .= '</td>'; + $r .= '<td colspan="2" class="pre">'.$lang['ExpenseConfigHelpBugSolver'].'</td>'; + $r .= $this->OverviewRowEnd($line++); } - $r .= '</select></td>'; - $r .= '<td colspan="2" class="pre">'.$lang['ExpenseConfigHelpFinishState'].'</td>'; - $r .= $this->OverviewRowEnd($line++); - $r .= $this->submit_reset_row(0,1,1,1,1,0); $r .= $this->DataTableEnd(); @@ -108,7 +190,7 @@ * */ function prepare() { - global $lang,$msg,$info,$tutos; + global $lang,$msg,$info,$tutos, $current_user; $this->name = $lang['ExpenseConfig']; $this->css_class = 'configbox'; @@ -115,8 +197,14 @@ // default if (!isset($tutos['expense_state_stc'])) $tutos['expense_state_stc'] = -1; - if (!isset($tutos['expense_closed_states'])) $tutos['expense_closed_states'] = BUG_STATE_SOLVED.','.BUG_STATE_CLOSED; - if (!isset($tutos['expense_finish_state'])) $tutos['bug_finish_state'] = BUG_STATE_CLOSED; + if (!isset($tutos['expense_auto_track'])) $tutos['expense_auto_track'] = 0; + if (!isset($tutos['expense_init_track_states'])) $tutos['expense_init:track_state'] = EXPENSE_STATE_REQUEST; + if (!isset($tutos['expense_auto_allow_state'])) $tutos['expense_auto_allow_state'] = EXPENSE_STATE_APPROVED; + if (!isset($tutos['expense_auto_deny_state'])) $tutos['expense_auto_deny_state'] = EXPENSE_STATE_REJECT; + if (!isset($tutos['expense_bug_allow_states'])) $tutos['expense_bug_allow_states'] = ''; + if (!isset($tutos['expense_bug_deny_states'])) $tutos['expense_bug_deny_states'] = ''; + if (!isset($tutos['expense_bug_inital_state'])) $tutos['expense_bug_inital_state'] = BUG_STATE_OPEN; + if (!isset($tutos['expense_bug_solver'])) $tutos['expense_bug_solver'] = $current_user->id; if ( ! $this->user->isAdmin() ) { $msg = addLine($msg,$this->error("Only admins are allowed to see this")); @@ -123,6 +211,9 @@ $this->stop = true; return; } + + $this->solver = getObject($this->dbconn,$tutos['expense_bug_solver']); + if (isset($_REQUEST['save']) && ($_REQUEST['save'] == 1) ) { // STC @@ -129,7 +220,49 @@ $tutos['expense_state_stc'] = $_REQUEST['state_stc']; write_config_value($this->dbconn,'expense_state_stc','expense'); + $tutos['expense_auto_track'] = ( isset($_REQUEST['auto_track']) ? $_REQUEST['auto_track']:0 ); + write_config_value($this->dbconn,'expense_auto_track','expense'); + // INIT STATES + if (isset($_REQUEST['init_track_states']) && is_array($_REQUEST['init_track_states'])) { + $tutos['expense_init_track_states'] = implode(',',$_REQUEST['init_track_states']); + } else { + $tutos['expense_init_track_states'] = ''; + } + write_config_value($this->dbconn,'expense_init_track_states','expense'); + + // Bug Allow States + if (isset($_REQUEST['bug_allow_states']) && is_array($_REQUEST['bug_allow_states'])) { + $tutos['expense_bug_allow_states'] = implode(',',$_REQUEST['bug_allow_states']); + } else { + $tutos['expense_bug_allow_states'] = ''; + } + write_config_value($this->dbconn,'expense_bug_allow_states','expense'); + + // Bug Deny States + if (isset($_REQUEST['bug_deny_states']) && is_array($_REQUEST['bug_deny_states'])) { + $tutos['expense_bug_deny_states'] = implode(',',$_REQUEST['bug_deny_states']); + } else { + $tutos['expense_bug_deny_states'] = ''; + } + write_config_value($this->dbconn,'expense_bug_deny_states','expense'); + + $tutos['expense_auto_allow_state'] = $_REQUEST['auto_allow_state']; + write_config_value($this->dbconn,'expense_auto_allow_state','expense'); + + $tutos['expense_auto_deny_state'] = $_REQUEST['auto_deny_state']; + write_config_value($this->dbconn,'expense_auto_deny_state','expense'); + + $tutos['expense_bug_initial_state'] = $_REQUEST['bug_initial_state']; + write_config_value($this->dbconn,'expense_bug_initial_state','expense'); + + // Solver + $tutos['expense_bug_solver'] = $_REQUEST['bug_solverid']; + if (!is_numeric($tutos['expense_bug_solver']) || $tutos['expense_bug_solver'] == '' ) { + $tutos['expense_bug_solver'] = $current_user->id; + } + write_config_value($this->dbconn,'expense_bug_solver','expense'); + $info = addLine($info,' saving done '); } } Modified: trunk/php/expense/expense_ins.php =================================================================== --- trunk/php/expense/expense_ins.php 2017-07-28 13:53:13 UTC (rev 1308) +++ trunk/php/expense/expense_ins.php 2017-07-31 14:35:54 UTC (rev 1309) @@ -71,7 +71,7 @@ $gotourl = addBadField($gotourl,'state',true); } else { $u->setState($_POST['state']); - $gotourl= addUrlParameter($gotourl,"state=". $state,true); + $gotourl= addUrlParameter($gotourl,"state=". $_POST['state'],true); } if ( isset($_POST['category']) ) { Modified: trunk/php/expense/expense_overview.php =================================================================== --- trunk/php/expense/expense_overview.php 2017-07-28 13:53:13 UTC (rev 1308) +++ trunk/php/expense/expense_overview.php 2017-07-31 14:35:54 UTC (rev 1309) @@ -1,6 +1,6 @@ <?php /** - * Copyright 1999 - 2014 by Gero Kohnert and ECOsoft.net + * Copyright 1999 - 2017 by Gero Kohnert and ECOsoft.net * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -141,7 +141,7 @@ $this->preflds++; } if ($this->head['state']) { - $r .= $this->orderHeader('',$lang['ExpenseState'],$this->link2); + $r .= $this->orderHeader('state',$lang['ExpenseState'],$this->link2); $this->flds++; $this->preflds++; } Modified: trunk/php/expense/fr.p3 =================================================================== --- trunk/php/expense/fr.p3 2017-07-28 13:53:13 UTC (rev 1308) +++ trunk/php/expense/fr.p3 2017-07-31 14:35:54 UTC (rev 1309) @@ -11,11 +11,13 @@ # Expenses $lang['Expense'] = "Dépense"; $lang['Expenses'] = "Dépenses"; +$lang['ExpenseConfig'] = 'Configure Expensemanagement'; $lang['ExpenseCreate'] = "Créer une dépense"; $lang['ExpenseCreateInfo'] = "Créér une dépense pour %s"; $lang['ExpenseDelete'] = "Annuler cette dépense"; $lang['ExpenseDescription'] = "Description"; $lang['ExpenseName'] = "Titre"; +$lang['ExpenseState'] = 'State'; $lang['ExpenseDetail'] = "Montrer les dépenses"; $lang['ExpenseOverview'] = "Vue d'ensemble des dépenses"; $lang['ExpenseCreation'] = "Enregistrer une dépense"; @@ -77,6 +79,25 @@ $lang['ExpenseMOPs'][5] = "Diners"; $lang['ExpenseMOPs'][6] = "Autre méthode de paiement"; +$lang['ExpenseStates'] = array(); +$lang['ExpenseStates'][1] = 'Request'; +$lang['ExpenseStates'][2] = 'Approved'; +$lang['ExpenseStates'][3] = 'Done'; +$lang['ExpenseStates'][4] = 'Payed'; +$lang['ExpenseStates'][5] = 'Rejected'; +$lang['ExpenseStates'][6] = 'prepare'; +$lang['ExpenseStates'][0] = 'undefined'; + +$lang['ExpenseConfigHelpStateSTC'] = 'STC state support for expense states'; +$lang['ExpenseConfigHelpTrack'] = 'use a tracker object to support the allow/deny proess'; +$lang['ExpenseConfigHelpInitTrackStates'] = 'States that automatically trigger a tracker object'; +$lang['ExpenseConfigHelpAutoAllowState'] = 'State to enter automatically for allow'; +$lang['ExpenseConfigHelpBugAllowStates'] = 'bug states that trigger a automatic allow'; +$lang['ExpenseConfigHelpAutoDenyState'] = 'State to enter automatically for deny'; +$lang['ExpenseConfigHelpBugDenyStates'] = 'bug states that trigger a automatic deny'; +$lang['ExpenseConfigHelpBugInitialState'] = 'intial state for newly created tracker object'; +$lang['ExpenseConfigHelpBugSolver'] = 'Solver Adress or Team'; + $lang['perm'][useexpenses] = "utilise les dépenses"; $lang['expense'] = &$lang['Dépense']; Modified: trunk/php/expense/hu.p3 =================================================================== --- trunk/php/expense/hu.p3 2017-07-28 13:53:13 UTC (rev 1308) +++ trunk/php/expense/hu.p3 2017-07-31 14:35:54 UTC (rev 1309) @@ -11,11 +11,13 @@ # Expenses $lang['Expense'] = "Kiadás"; $lang['Expenses'] = "Kiadások"; +$lang['ExpenseConfig'] = 'Configure Expensemanagement'; $lang['ExpenseCreate'] = "Kiadás létrehozása"; $lang['ExpenseCreateInfo'] = "Új kiadás létrehozása %s számára"; $lang['ExpenseDelete'] = "Kiadás törlése"; $lang['ExpenseDescription'] = "Leírás"; $lang['ExpenseName'] = "Cím"; +$lang['ExpenseState'] = 'State'; $lang['ExpenseDetail'] = "Kiadások kijelzése"; $lang['ExpenseOverview'] = "Kiadások áttekintése"; $lang['ExpenseCreation'] = "Kiadások létrehozása"; @@ -77,6 +79,25 @@ $lang['ExpenseMOPs'][5] = "Diners"; $lang['ExpenseMOPs'][6] = "más fizetési mód"; +$lang['ExpenseStates'] = array(); +$lang['ExpenseStates'][1] = 'Request'; +$lang['ExpenseStates'][2] = 'Approved'; +$lang['ExpenseStates'][3] = 'Done'; +$lang['ExpenseStates'][4] = 'Payed'; +$lang['ExpenseStates'][5] = 'Rejected'; +$lang['ExpenseStates'][6] = 'prepare'; +$lang['ExpenseStates'][0] = 'undefined'; + +$lang['ExpenseConfigHelpStateSTC'] = 'STC state support for expense states'; +$lang['ExpenseConfigHelpTrack'] = 'use a tracker object to support the allow/deny proess'; +$lang['ExpenseConfigHelpInitTrackStates'] = 'States that automatically trigger a tracker object'; +$lang['ExpenseConfigHelpAutoAllowState'] = 'State to enter automatically for allow'; +$lang['ExpenseConfigHelpBugAllowStates'] = 'bug states that trigger a automatic allow'; +$lang['ExpenseConfigHelpAutoDenyState'] = 'State to enter automatically for deny'; +$lang['ExpenseConfigHelpBugDenyStates'] = 'bug states that trigger a automatic deny'; +$lang['ExpenseConfigHelpBugInitialState'] = 'intial state for newly created tracker object'; +$lang['ExpenseConfigHelpBugSolver'] = 'Solver Adress or Team'; + $lang['perm'][useexpenses] = "kiadások használata"; $lang['expense'] = &$lang['Expense']; Modified: trunk/php/expense/mconfig.pinc =================================================================== --- trunk/php/expense/mconfig.pinc 2017-07-28 13:53:13 UTC (rev 1308) +++ trunk/php/expense/mconfig.pinc 2017-07-31 14:35:54 UTC (rev 1309) @@ -40,6 +40,7 @@ // // Files (like invoices etc) could be added // +$tutos[modulesinc]['bugtracking'][] = "expense"; $tutos[modulesinc]['file'][] = "expense"; $tutos['docowners'][] = 'expense'; Modified: trunk/php/expense/tw.p3 =================================================================== --- trunk/php/expense/tw.p3 2017-07-28 13:53:13 UTC (rev 1308) +++ trunk/php/expense/tw.p3 2017-07-31 14:35:54 UTC (rev 1309) @@ -11,11 +11,13 @@ # Expenses $lang['Expense'] = "開支"; $lang['Expenses'] = "開支"; +$lang['ExpenseConfig'] = 'Configure Expensemanagement'; $lang['ExpenseCreate'] = "建立開支"; $lang['ExpenseCreateInfo'] = "建立 %s 的新開支"; $lang['ExpenseDelete'] = "刪除開支"; $lang['ExpenseDescription'] = "內容"; $lang['ExpenseName'] = "開支名稱"; +$lang['ExpenseState'] = 'State'; $lang['ExpenseDetail'] = "開支顯示"; $lang['ExpenseOverview'] = "開支概況"; $lang['ExpenseCreation'] = "開支建立"; @@ -77,6 +79,25 @@ $lang['ExpenseMOPs'][5] = "大來卡"; $lang['ExpenseMOPs'][6] = "其他付款方法"; +$lang['ExpenseStates'] = array(); +$lang['ExpenseStates'][1] = 'Request'; +$lang['ExpenseStates'][2] = 'Approved'; +$lang['ExpenseStates'][3] = 'Done'; +$lang['ExpenseStates'][4] = 'Payed'; +$lang['ExpenseStates'][5] = 'Rejected'; +$lang['ExpenseStates'][6] = 'prepare'; +$lang['ExpenseStates'][0] = 'undefined'; + +$lang['ExpenseConfigHelpStateSTC'] = 'STC state support for expense states'; +$lang['ExpenseConfigHelpTrack'] = 'use a tracker object to support the allow/deny proess'; +$lang['ExpenseConfigHelpInitTrackStates'] = 'States that automatically trigger a tracker object'; +$lang['ExpenseConfigHelpAutoAllowState'] = 'State to enter automatically for allow'; +$lang['ExpenseConfigHelpBugAllowStates'] = 'bug states that trigger a automatic allow'; +$lang['ExpenseConfigHelpAutoDenyState'] = 'State to enter automatically for deny'; +$lang['ExpenseConfigHelpBugDenyStates'] = 'bug states that trigger a automatic deny'; +$lang['ExpenseConfigHelpBugInitialState'] = 'intial state for newly created tracker object'; +$lang['ExpenseConfigHelpBugSolver'] = 'Solver Adress or Team'; + $lang['perm'][useexpenses] = "使用開支"; $lang['expense'] = &$lang['Expense']; ?> Modified: trunk/php/expense/zh.p3 =================================================================== --- trunk/php/expense/zh.p3 2017-07-28 13:53:13 UTC (rev 1308) +++ trunk/php/expense/zh.p3 2017-07-31 14:35:54 UTC (rev 1309) @@ -11,11 +11,13 @@ # Expenses $lang['Expense'] = "开支"; $lang['Expenses'] = "开支"; +$lang['ExpenseConfig'] = 'Configure Expensemanagement'; $lang['ExpenseCreate'] = "建立开支"; $lang['ExpenseCreateInfo'] = "建立 %s 的新开支"; $lang['ExpenseDelete'] = "删除开支"; $lang['ExpenseDescription'] = "內容"; $lang['ExpenseName'] = "开支名称"; +$lang['ExpenseState'] = 'State'; $lang['ExpenseDetail'] = "开支显示"; $lang['ExpenseOverview'] = "开支概況"; $lang['ExpenseCreation'] = "开支建立"; @@ -77,6 +79,25 @@ $lang['ExpenseMOPs'][5] = "大来卡"; $lang['ExpenseMOPs'][6] ="其他付款方法"; +$lang['ExpenseStates'] = array(); +$lang['ExpenseStates'][1] = 'Request'; +$lang['ExpenseStates'][2] = 'Approved'; +$lang['ExpenseStates'][3] = 'Done'; +$lang['ExpenseStates'][4] = 'Payed'; +$lang['ExpenseStates'][5] = 'Rejected'; +$lang['ExpenseStates'][6] = 'prepare'; +$lang['ExpenseStates'][0] = 'undefined'; + +$lang['ExpenseConfigHelpStateSTC'] = 'STC state support for expense states'; +$lang['ExpenseConfigHelpTrack'] = 'use a tracker object to support the allow/deny proess'; +$lang['ExpenseConfigHelpInitTrackStates'] = 'States that automatically trigger a tracker object'; +$lang['ExpenseConfigHelpAutoAllowState'] = 'State to enter automatically for allow'; +$lang['ExpenseConfigHelpBugAllowStates'] = 'bug states that trigger a automatic allow'; +$lang['ExpenseConfigHelpAutoDenyState'] = 'State to enter automatically for deny'; +$lang['ExpenseConfigHelpBugDenyStates'] = 'bug states that trigger a automatic deny'; +$lang['ExpenseConfigHelpBugInitialState'] = 'intial state for newly created tracker object'; +$lang['ExpenseConfigHelpBugSolver'] = 'Solver Adress or Team'; + $lang['perm'][useexpenses] = "使用开支"; $lang['expense'] = &$lang['Expense']; ?> Modified: trunk/php/watchlist/watchlist.pinc =================================================================== --- trunk/php/watchlist/watchlist.pinc 2017-07-28 13:53:13 UTC (rev 1308) +++ trunk/php/watchlist/watchlist.pinc 2017-07-31 14:35:54 UTC (rev 1309) @@ -228,10 +228,13 @@ $n = $r->numrows(); $a = 0; while ($a < $n) { - $adr = new tutos_address($obj->dbconn); - $adr = $adr->read($r->get($a, "adr_id"),$adr); + $adr = getObject($obj->dbconn,$r->get($a, "adr_id")); + if ( is_object($adr) ) { + # $adr = new tutos_address($obj->dbconn); + # $adr = $adr->read($r->get($a, "adr_id"),$adr); - $obj->list[usewatchlist][$adr->id] = &$adr; + $obj->list[usewatchlist][$adr->id] = &$adr; + } $a++; unset($adr); } @@ -337,14 +340,19 @@ $url = getBaseUrl(true) .$tutos['base'] .'/php/'. $obj->getUrl();; foreach ($obj->list[usewatchlist] as $i => $f) { - $f->read_locs_data(true); - $body = ''; - $mformat = 'text/plain'; - $msg .= check_template('watch.proto', $f,$body,$mformat); + if ($f->getType() == 'address') { + $f->read_locs_data(true); + $body = ''; + $mformat = 'text/plain'; + $msg .= check_template('watch.proto', $f,$body,$mformat); - $blist = array(); - $msg = addLine($msg,send_mail($f, $user, $f->lg['EmailChanged'], $body,$mformat, $url, $obj,$blist)); - + $blist = array(); + $msg = addLine($msg,send_mail($f, $user, $f->lg['EmailChanged'], $body,$mformat, $url, $obj,$blist)); + } else { + // non human watcher + $msg = addLine($msg,$f->trigger($obj,'change')); + $msg = addLine($msg,'Informed:'.$f->getLink()); + } watchlist::update($obj, $f); } return $msg; @@ -369,12 +377,18 @@ $url = getBaseURL(true) . $obj->getUrl(); foreach ($obj->list[usewatchlist] as $i => $f) { - $body = ''; - $mformat = 'text/plain'; - $msg .= check_template('watch_del.proto', $f,$body,$mformat); + if ($f->getType() == 'address') { + $body = ''; + $mformat = 'text/plain'; + $msg .= check_template('watch_del.proto', $f,$body,$mformat); - $blist = array(); - $msg = addLine($msg,send_mail($f, $user,$f->lg['EmailDeleted'], $body, $mformat, $url, $obj, $blist)); + $blist = array(); + $msg = addLine($msg,send_mail($f, $user,$f->lg['EmailDeleted'], $body, $mformat, $url, $obj, $blist)); + } else { + // non human watcher + $msg = addLine($msg,$f->trigger($obj,'delete')); + $msg = addLine($msg,'Informed:'.$f->getLink()); + } } $q = 'DELETE from '. $obj->dbconn->prefix .'watchlist where obj_id = '. $obj->id; $obj->dbconn->Exec($q); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gok...@us...> - 2017-07-28 13:53:16
|
Revision: 1308 http://sourceforge.net/p/tutos/code/1308 Author: gokohnert Date: 2017-07-28 13:53:13 +0000 (Fri, 28 Jul 2017) Log Message: ----------- added state field Added Paths: ----------- trunk/php/expense/expense_config.php Added: trunk/php/expense/expense_config.php =================================================================== --- trunk/php/expense/expense_config.php (rev 0) +++ trunk/php/expense/expense_config.php 2017-07-28 13:53:13 UTC (rev 1308) @@ -0,0 +1,145 @@ +<?php +/** + * Copyright 2009 - 2017 by Gero Kohnert + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; version 2 of the License. + * + * SVN Info $Id: bug_config.php 1016 2013-03-13 11:59:14Z gokohnert $ + * $Author: gokohnert $ + */ +$tutos['files'][__FILE__] = '$Rev: 1016 $'; + +$tutos['base'] = "../.."; +ini_set("include_path",".."); + +require_once 'webelements.p3'; +require_once 'permission.p3'; + +check_user(); +loadmodules('expense','config'); +loadmodule('expense'); +loadlayout(); + +/** + * display a admin page + */ +class Expense_config extends layout { + /** + * + */ + function info() { + global $lang,$table,$tutos; + + $r = ''; + $r .= "<form id=\"expenseconfig\" name=\"expenseconfig\" action=\"expense_config.php\" method=\"post\">\n"; + $r .= $this->DataTableStart(); + $line = 0; + $r .= $this->OverviewHeadLineStart(); + $r .= '<th colspan="4">'.$this->name.'</th>'; + $r .= $this->OverviewHeadLineEnd(); + + + // STC + $r .= $this->OverviewRowStart($line); + $r .= $this->showfield('expense_state_stc'); + $r .= '<td><select name="state_stc">'."\n"; + $r .= ' <option value="-1"'.($tutos['expense_state_stc'] == -1 ? ' selected="selected"':'').'>'.$lang['no'].'</option>'."\n"; + stc::getListByLangArray($this,'ExpenseStates'); + foreach($this->stcs as $j) { + $r .= ' <option value="'.$j->id.'"'.($tutos['expense_state_stc'] == $j->id ? ' selected="selected"':'').'>'.$j->getLink().'</option>'."\n"; + } + $r .= '</select>'; + $r .= '<br />'.makelink('stc/stc_new.php?lgarr=ExpenseStates&mod=expense','Create a new STC'); + $r .= '</td>'; + $r .= '<td colspan="2" class="pre">'.myentities($lang['ExpenseConfigHelpStateSTC']).'</td>'; + $r .= $this->OverviewRowEnd($line++); + + + // states that are like closed + $r .= $this->OverviewRowStart($line); + $r .= $this->showfield('expense_closed_states'); + $stc = getObject($this->user->dbconn,$tutos['expense_state_stc']); + if (!is_object($stc)) { + $stc = new stc(null); + $stc->initByArray('ExpenseStates',null); + } + $x = preg_split('#,#',$tutos['expense_closed_states']); + $r .= '<td><select multiple="multiple" name="closed_states[]">'."\n"; + foreach ($stc->states as $f) { + $r .= ' <option value="'. $f->stc_state .'" style="background:'.$f->color.'"'; + if (in_array($f->stc_state,$x)) { + $r .= ' selected="selected"'; + } + $r .= '>'. myentities($f->getFullName()) ."</option>\n"; + } + $r .= '</select></td>'; + $r .= '<td colspan="2" class="pre">'.$lang['ExpenseConfigHelpClosedStates'].'</td>'; + $r .= $this->OverviewRowEnd($line++); + + // state to set on auto finish + $r .= $this->OverviewRowStart($line); + $r .= $this->showfield('expense_finish_state'); + $r .= '<td><select name="finish_state">'."\n"; + foreach ($stc->states as $f) { + $r .= ' <option value="'. $f->stc_state .'" style="background:'.$f->color.'"'; + if ($f->stc_state == $tutos['expense_finish_state']) { + $r .= ' selected="selected"'; + } + $r .= '>'. myentities($f->getFullName()) ."</option>\n"; + } + $r .= '</select></td>'; + $r .= '<td colspan="2" class="pre">'.$lang['ExpenseConfigHelpFinishState'].'</td>'; + $r .= $this->OverviewRowEnd($line++); + + + $r .= $this->submit_reset_row(0,1,1,1,1,0); + + $r .= $this->DataTableEnd(); + $this->addHidden("save", 1); + $r .= hiddenFormElements(); + $r .= $this->getHidden(); + $r .= "</form>\n"; + return $r; + } + + /** + * + */ + function prepare() { + global $lang,$msg,$info,$tutos; + + $this->name = $lang['ExpenseConfig']; + $this->css_class = 'configbox'; + + // default + if (!isset($tutos['expense_state_stc'])) $tutos['expense_state_stc'] = -1; + if (!isset($tutos['expense_closed_states'])) $tutos['expense_closed_states'] = BUG_STATE_SOLVED.','.BUG_STATE_CLOSED; + if (!isset($tutos['expense_finish_state'])) $tutos['bug_finish_state'] = BUG_STATE_CLOSED; + + if ( ! $this->user->isAdmin() ) { + $msg = addLine($msg,$this->error("Only admins are allowed to see this")); + $this->stop = true; + return; + } + if (isset($_REQUEST['save']) && ($_REQUEST['save'] == 1) ) { + + // STC + $tutos['expense_state_stc'] = $_REQUEST['state_stc']; + write_config_value($this->dbconn,'expense_state_stc','expense'); + + + $info = addLine($info,' saving done '); + } + } +} + +$l = new Expense_config($current_user); +$l->display(); +$dbconn->close(); +?> +<!-- +SVN Info $Id: bug_config.php 1016 2013-03-13 11:59:14Z gokohnert $ +$Author: gokohnert $ +--> \ No newline at end of file Property changes on: trunk/php/expense/expense_config.php ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/x-php \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gok...@us...> - 2017-07-28 13:49:01
|
Revision: 1307 http://sourceforge.net/p/tutos/code/1307 Author: gokohnert Date: 2017-07-28 13:48:59 +0000 (Fri, 28 Jul 2017) Log Message: ----------- added state field Modified Paths: -------------- trunk/php/expense/de.p3 trunk/php/expense/en.p3 trunk/php/expense/expense.pinc trunk/php/expense/expense_ins.php trunk/php/expense/expense_new.php trunk/php/expense/expense_overview.php trunk/php/expense/expense_select.php trunk/php/expense/expense_show.php trunk/php/expense/mconfig.pinc trunk/php/expense/mtable.pinc Modified: trunk/php/expense/de.p3 =================================================================== --- trunk/php/expense/de.p3 2017-07-08 15:54:00 UTC (rev 1306) +++ trunk/php/expense/de.p3 2017-07-28 13:48:59 UTC (rev 1307) @@ -1,21 +1,23 @@ <?php -# $Id$ -# -# ========================= NOTE ======================== -# Please put site specific extensions and changes -# to TUTOS language files in a file called 'de_custom.p3' -# or 'lang_custom.p3' (for all languages) -# using the same format like here -# ======================================================= +// $Id$ +// +// ========================= NOTE ======================== +// Please put site specific extensions and changes +// to TUTOS language files in a file called 'de_custom.p3' +// or 'lang_custom.p3' (for all languages) +// using the same format like here +// ======================================================= -# Expenses +// Expenses $lang['Expense'] = 'Spesen'; $lang['Expenses'] = 'Spesen'; +$lang['ExpenseConfig'] = 'Spesenmanagement konfigurieren'; $lang['ExpenseCreate'] = 'Spesen buchen'; $lang['ExpenseCreateInfo'] = 'Neuen Spesen zu %s anlegen'; $lang['ExpenseDelete'] = 'Spesen löschen'; $lang['ExpenseDescription'] = 'Beschreibung'; $lang['ExpenseName'] = 'Bezeichnung'; +$lang['ExpenseState'] = 'Status'; $lang['ExpenseDetail'] = 'Spesen anzeigen'; $lang['ExpenseOverview'] = 'Spesenübersicht'; $lang['ExpenseCreation'] = 'Spesen buchen'; @@ -77,6 +79,15 @@ $lang['ExpenseMOPs'][5] = 'Diners'; $lang['ExpenseMOPs'][6] = 'Sonstige Zahlungsarten'; +$lang['ExpenseStates'] = array(); +$lang['ExpenseStates'][1] = 'angefordert'; +$lang['ExpenseStates'][2] = 'genehmigt'; +$lang['ExpenseStates'][3] = 'erledigt'; +$lang['ExpenseStates'][4] = 'bezahlt'; +$lang['ExpenseStates'][5] = 'verweigert'; +$lang['ExpenseStates'][6] = 'in Vorbereitung'; +$lang['ExpenseStates'][0] = 'undefiniert'; + $lang['perm'][useexpenses] = 'Spesennutzung'; $lang['expense'] = &$lang['Expense']; Modified: trunk/php/expense/en.p3 =================================================================== --- trunk/php/expense/en.p3 2017-07-08 15:54:00 UTC (rev 1306) +++ trunk/php/expense/en.p3 2017-07-28 13:48:59 UTC (rev 1307) @@ -1,21 +1,23 @@ <?php -# $Id$ -# -# ========================= NOTE ======================== -# Please put site specific extensions and changes -# to TUTOS language files in a file called 'en_custom.p3' -# or 'lang_custom.p3' (for all languages) -# using the same format like here -# ======================================================= +// $Id$ +// +// ========================= NOTE ======================== +// Please put site specific extensions and changes +// to TUTOS language files in a file called 'en_custom.p3' +// or 'lang_custom.p3' (for all languages) +// using the same format like here +// ======================================================= -# Expenses +// Expenses $lang['Expense'] = 'Expenses'; $lang['Expenses'] = 'Expenses'; +$lang['ExpenseConfig'] = 'Configure Expensemanagement'; $lang['ExpenseCreate'] = 'Create expenses'; $lang['ExpenseCreateInfo'] = 'Create new expenses for %s'; $lang['ExpenseDelete'] = 'Delete this expenses'; $lang['ExpenseDescription'] = 'Description'; $lang['ExpenseName'] = 'Title'; +$lang['ExpenseState'] = 'State'; $lang['ExpenseDetail'] = 'Expenses Display'; $lang['ExpenseOverview'] = 'Expenses Overview'; $lang['ExpenseCreation'] = 'Expenses Creation'; @@ -77,6 +79,15 @@ $lang['ExpenseMOPs'][5] = 'Diners'; $lang['ExpenseMOPs'][6] = 'Other method of payments'; +$lang['ExpenseStates'] = array(); +$lang['ExpenseStates'][1] = 'Request'; +$lang['ExpenseStates'][2] = 'Approved'; +$lang['ExpenseStates'][3] = 'Done'; +$lang['ExpenseStates'][4] = 'Payed'; +$lang['ExpenseStates'][5] = 'Rejected'; +$lang['ExpenseStates'][6] = 'prepare'; +$lang['ExpenseStates'][0] = 'undefined'; + $lang['perm'][useexpenses] = 'use expenses'; $lang['expense'] = &$lang['Expense']; Modified: trunk/php/expense/expense.pinc =================================================================== --- trunk/php/expense/expense.pinc 2017-07-08 15:54:00 UTC (rev 1306) +++ trunk/php/expense/expense.pinc 2017-07-28 13:48:59 UTC (rev 1307) @@ -1,6 +1,6 @@ <?php /** - * Copyright 1999 - 2013 by Gero Kohnert and ECOsoft.net + * Copyright 1999 - 2017 by Gero Kohnert and ECOsoft.net * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -11,6 +11,14 @@ */ $tutos['files'][__FILE__] = '$Rev$'; +define ('EXPENSE_STATE_REQUEST',1); +define ('EXPENSE_STATE_APPROVED',2); +define ('EXPENSE_STATE_DONE',3); +define ('EXPENSE_STATE_PAYED',4); +define ('EXPENSE_STATE_REJECT',5); + +define ('EXPENSE_STATE_UNDEF',0); // old expenses befire using states + /* --------------------------------------------------------------------------- * List all expenses * cols > 0 make sperate rows with cols columns for each expense @@ -58,6 +66,33 @@ } /** + * ask a expense state + */ +function ExpenseAskState ($default) { + global $lang,$tutos,$current_user; + + $stc = getObject($current_user->dbconn,$tutos['expense_state_stc']); + if (!is_object($stc)) { + $stc = new stc(null); + $stc->initByArray('ExpenseStates',Expense::$c_state); + } + + $r = '<select id="state" name="state[]" multiple="multiple">'."\n"; + foreach ($stc->states as $f) { + if($f->stc_state == STC_NOT_EXISTANT) continue; + $r .= ' <option value="'. $f->stc_state .'" style="background:'.$f->color.'"'; + if ( $f->stc_state == $default ) { + $r .= ' selected="selected"'; + } + $r .= '>'. myentities($f->getFullName()) ."</option>\n"; + } + + $r .= "</select>\n"; + + return $r; +} + +/** * ask a expense category */ function ExpenseAskCategory ($default,$any) { @@ -126,6 +161,14 @@ */ static public $revision = '$Rev$'; + static public $c_state = array(EXPENSE_STATE_REQUEST => "aqua", + EXPENSE_STATE_PREPARE => "beige", + EXPENSE_STATE_APPROVED => "orange", + EXPENSE_STATE_DONE => "yellow", + EXPENSE_STATE_PAYED => "green", + EXPENSE_STATE_REJECT => "red", + EXPENSE_STATE_UNDEF => "white" + ); /** * constructor */ @@ -135,6 +178,7 @@ $this->init($dbconn); $this->name = ''; + $this->state = -1; $this->description = ''; $this->link_id = null; $this->adr_id = null; @@ -172,6 +216,7 @@ $this->sup_id = $r->get($pos, 'supplier'); $this->adr_id = $r->get($pos, 'adr_id'); $this->name = $r->get($pos, 'name'); + $this->state = $r->get($pos, 'state'); $this->description = $r->get($pos, 'description'); $this->quantity = $r->get($pos, 'quantity'); $this->gamount = $r->get($pos, 'gamount'); @@ -194,6 +239,9 @@ if ($this->quantity == null) { $this->quantity = 1.0; } + if ($this->state == null) { + $this->state = EXPENSE_STATE_UNDEF; + } parent::read_result($r,$pos); return; } @@ -318,6 +366,28 @@ return $lang['HistoryDeleted']; } + /** + * create a select list with possible states + */ + function askState () { + global $tutos,$lang; + + $r = ''; + $stc = getObject($this->dbconn,$tutos['expense_state_stc']); + if (!is_object($stc)) { + $stc = new stc(null); + $stc->initByArray('ExpenseStates',self::$c_state); + /* if ($this->state == EXPENSE_STATE_UNDEF) { */ + /* $r .= $lang['ExpenseAutoState'] .' '; */ + /* $r .= $this->getState().'<input id="stc_state" type="hidden" name="state" value="'. $this->state ."\" />\n"; */ + /* return $r; */ + /* } */ + } + $stc->stateowner = $this; + $r .= $stc->getStateSelection($this->state,'state'); + return $r; + } + function askCategory () { $r = ExpenseAskCategory($this->category,0); return $r; @@ -450,6 +520,30 @@ } /** + * get current state of this expense (default) as HTML + */ + function getState ($s = "") { + global $tutos,$lang; + + $r = ''; + if ( empty($s) ) { + $s = $this->state; + } + + $stc = getObject($this->dbconn,$tutos['expense_state_stc']); + if (!is_object($stc)) { + $stc = new stc(null); + $stc->initByArray('ExpenseStates',self::$c_state); + if ($s == -1) { + $this->state = EXPENSE_STATE_UNDEF; + $s = $this->state; + } + } + $r .= $stc->getState($s); + return $r; + } + + /** * Return a link to this expense */ function getLink($text = '',$arg = '') { @@ -503,6 +597,13 @@ } /** + * set the state + */ + function setState($value) { + return $this->setIntField("state",$value,"ExpenseState"); + } + + /** * set the expense category */ function setCategory($value) { @@ -680,6 +781,7 @@ $q = new Query($this->dbconn); $q->setTable($this->tablename); $q->addFV('name',$this->name,'STRING',$table['expense']['name'][size]); + $q->addFV('state',$this->state,'INT'); $q->addFV('category',$this->category,'INT'); $q->addFV('reason',$this->reason,'STRING',$table['expense']['reason'][size]); $q->addFV('city',$this->city,'STRING',$table['expense']['city'][size]); @@ -855,6 +957,9 @@ case 'ExpenseEndTime': $x = resolve_history_datetime($f,$this->dbconn,false); break; + case 'ExpenseState': + $x = resolve_history_lgarr ($f,'ExpenseStates'); + break; default: return null; } @@ -881,7 +986,25 @@ static function getHtmlIcon () { return 'coins'; } + /** + * get a array with virtual groups used in STC for state changes + */ + function getStateObjectGroups(array &$x,Stc_transition $stc) { + global $lang,$tutos; + + $x[$stc->getTypeId()][2] = $lang[$stc->getType()].':'.$lang['Expense'].' - '.$lang['ExpenseAddress']; + $x[$stc->getTypeId()][3] = $lang[$stc->getType()].':'.$lang['Expense'].' - '.$lang['ExpenseSupplier']; + + $x[$stc->getTypeId()][8] = $lang[$stc->getType()].':'.$lang['Expense'].' '.$lang['ExpenseReference'].' '.$lang['ProdRoles']; + foreach ($lang['ProdRole'] as $role => $f) { + if ( $tutos[rolecheck][$role] != "p") { + $x[$stc->getTypeId()][10+$role] = $lang[$stc->getType()].':'.$lang['Expense'].' '.$lang['ExpenseReference'].' '.$lang['Product'].' - '.$f; + } + } + } + + /** * get a array with virtual groups */ function getObjectGroups() { @@ -891,6 +1014,13 @@ $x[$this->getTypeId()][2] = $lang[$this->getType()].':'.$lang['ExpenseAddress']; $x[$this->getTypeId()][3] = $lang[$this->getType()].':'.$lang['ExpenseSupplier']; + $x[$this->getTypeId()][8] = $lang[$this->getType()].':'.$lang['ExpenseReference'].' '.$lang['ProdRoles']; + foreach ($lang['ProdRole'] as $role => $f) { + if ( $tutos[rolecheck][$role] != "p") { + $x[$this->getTypeId()][10+$role] = $lang[$this->getType()].':'.$lang['ExpenseReference'].' '.$lang['Product'].' - '.$f; + } + } + return $x; } @@ -918,6 +1048,21 @@ $x[$this->sup_id] = $this->supplier; } + // reference project roles + if (is_object($this->ref) && ($this->ref->getTypeId() == useprojects) ) { + $this->ref->readroles(); + // All Parent Project Roles + if ($id2 == 8) { + $x = $this->ref->getObjectGroupList(8); + } + foreach ($lang['ProdRole'] as $role => $f) { + if ( $tutos[rolecheck][$role] == "p") continue; + if ($role+10 == $id2) { + $x = $this->ref->getObjectGroupList($role+128); + } + } + } + return $x; } Modified: trunk/php/expense/expense_ins.php =================================================================== --- trunk/php/expense/expense_ins.php 2017-07-08 15:54:00 UTC (rev 1306) +++ trunk/php/expense/expense_ins.php 2017-07-28 13:48:59 UTC (rev 1307) @@ -1,6 +1,6 @@ <?php /** - * Copyright 1999 - 2013 by Gero Kohnert and ECOsoft.net + * Copyright 1999 - 2017 by Gero Kohnert and ECOsoft.net * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -47,7 +47,7 @@ $bad = true; } if ( !checkfloat($_POST['quantity'],true) ) { - $gotourl = addBadField($gotourl,'quaantity',true); + $gotourl = addBadField($gotourl,'quantity',true); $bad = true; } @@ -65,6 +65,15 @@ $u->setName(trim($_POST['name'])); $gotourl= addUrlParameter($gotourl,"name=". UrlEncode($u->name),true); } + +if ( empty($_POST['state']) || !isset($_POST['state']) ) { + $msg = addLine($msg,sprintf($lang['Err0009'],$lang['ExpenseState'])); + $gotourl = addBadField($gotourl,'state',true); +} else { + $u->setState($_POST['state']); + $gotourl= addUrlParameter($gotourl,"state=". $state,true); +} + if ( isset($_POST['category']) ) { $u->setCategory($_POST['category']); $gotourl= addUrlParameter($gotourl,"category=". UrlEncode($u->category),true); Modified: trunk/php/expense/expense_new.php =================================================================== --- trunk/php/expense/expense_new.php 2017-07-08 15:54:00 UTC (rev 1306) +++ trunk/php/expense/expense_new.php 2017-07-28 13:48:59 UTC (rev 1307) @@ -1,6 +1,6 @@ <?php /** - * Copyright 1999 - 2014 by Gero Kohnert and ECOsoft.net + * Copyright 1999 - 2017 by Gero Kohnert and ECOsoft.net * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -46,7 +46,7 @@ $this->addhidden('Xid',$this->obj->id); } - $r .= "<tr>\n"; + $r .= $this->EditRowStart(); $r .= $this->showfieldc($lang['ExpenseReference'],1,"link_id"); $r .= " <td colspan=\"5\">\n"; if ($this->obj->id == -1) { @@ -63,65 +63,70 @@ $this->addhidden("link_id",$this->obj->link_id); } $r .= " </td>\n"; - $r .= "</tr>\n"; + $r .= $this->EditRowEnd(); - $r .= "<tr>\n"; + $r .= $this->EditRowStart(); + $r .= $this->showfieldc($lang['ExpenseState'],1,"state"); + $r .= $this->showData($this->obj->askState(),$this->width-1); + $r .= $this->EditRowEnd(); + + $r .= $this->EditRowStart(); $r .= $this->showfieldc($lang['ExpenseSupplier'],1,"sid"); - $r .= " <td colspan=\"5\">\n"; if (!isset($this->fixate['sid']) || !$this->fixate['sid'] ) { - $r .= select_from_array_or_input($this->obj,'s',$this->obj->supplier,0,'cd'); + $d = select_from_array_or_input($this->obj,'s',$this->obj->supplier,0,'cd'); } else { - $r .= $this->obj->supplier->getLink(); + $d = $this->obj->supplier->getLink(); $this->addhidden("sid",$this->obj->supplier->id); } - $r .= " </td>\n"; - $r .= "</tr>\n"; + $r .= $this->showData($d,$this->width-1); + $r .= $this->EditRowEnd(); - $r .= "<tr>\n"; + $r .= $this->EditRowStart(); $r .= $this->showfieldc($lang['ExpenseAddress'],1,"aid"); - $r .= " <td colspan=\"5\">\n"; if (!isset($this->fixate['aid']) || !$this->fixate['aid'] ) { - $r .= select_from_array_or_input($this->obj,'a',$this->obj->adr_ref,0,'a'); + $d = select_from_array_or_input($this->obj,'a',$this->obj->adr_ref,0,'a'); } else { - $r .= $this->obj->adr_ref->getLink(); + $d = $this->obj->adr_ref->getLink(); $this->addhidden("aid",$this->obj->adr_ref->id); } - $r .= " </td>\n"; - $r .= "</tr>\n"; + $r .= $this->showData($d,$this->width-1); + $r .= $this->EditRowEnd(); - $r .= "<tr>\n"; + $r .= $this->EditRowStart(); $r .= $this->showfieldc($lang['ExpenseName'],1,"name"); $r .= ' <td colspan="5"><input class="required_fld" id="name" size="80" maxlength="'. $table['expense']['name'][size] .'" name="name" value="'. myentities($this->obj->name) ."\" /></td>\n"; - $r .= "</tr>\n"; + $r .= $this->EditRowEnd(); if (!isset($this->hide['category']) || !$this->hide['category'] ) { - $r .= "<tr>\n"; + $r .= $this->EditRowStart(); $r .= $this->showfieldc($lang['ExpenseCategory'],0,"category"); $r .= " <td colspan=\"5\">\n"; $r .= $this->obj->askCategory(); $r .= " </td>\n"; - $r .= "</tr>\n"; + $r .= $this->EditRowEnd(); } else { $this->addhidden("category",-1); } - $r .= "<tr>\n"; + + $r .= $this->EditRowStart(); $r .= $this->showfieldc($lang['ExpenseReason'],0,"reason"); $r .= ' <td colspan="5"><input id="reason" size="80" maxlength="'. $table['expense']['reason'][size] .'" name="reason" value="'. myentities($this->obj->reason) ."\" /></td>\n"; - $r .= "</tr>\n"; + $r .= $this->EditRowEnd(); if (!isset($this->hide['people']) || !$this->hide['people'] ) { - $r .= "<tr>\n"; + $r .= $this->EditRowStart(); $r .= $this->showfieldc($lang['ExpensePeople'],0,"people"); - $r .= ' <td colspan="5"><textarea id="people" rows="1" cols="60" name="people">'. $this->obj->people ."</textarea></td>\n"; - $r .= "</tr>\n"; + $r .= $this->showData('<textarea id="people" rows="1" cols="60" name="people">'. $this->obj->people .'</textarea>',$this->width-1); + $r .= $this->EditRowEnd(); } - $r .= "<tr>\n"; + + $r .= $this->EditRowStart(); $r .= $this->showfieldc($lang['ExpenseQuantity'],0,"quantity"); $check = ""check_all_float(this,'".$lang['DecPoint']."');\""; - $r .= ' <td colspan="5"><input id="quantity" size="10" maxlength="10" name="quantity" '.$check.' value="'. my_number_format($this->obj->quantity,2) ."\" />\n"; - $r .= "</tr>\n"; + $r .= $this->showData('<input id="quantity" size="10" maxlength="10" name="quantity" '.$check.' value="'. my_number_format($this->obj->quantity,2) .'" />',$this->width-1); + $r .= $this->EditRowEnd(); - $r .= "<tr>\n"; + $r .= $this->EditRowStart(); $r .= $this->showfieldc($lang['ExpenseGAmount'],1,"gamount"); $check = ""check_all_float(this,'".$lang['DecPoint']."');\""; $r .= ' <td colspan="2"><input id="gamount" size="10" maxlength="10" name="gamount" '. $check.' value="'. my_number_format($this->obj->gamount,2) ."\" />\n"; @@ -131,16 +136,16 @@ $r .= " <td colspan=\"2\">\n"; $r .= TAX_select("itax",$this->obj->itax); $r .= " </td>\n"; - $r .= "</tr>\n"; + $r .= $this->EditRowEnd(); - $r .= "<tr>\n"; + $r .= $this->EditRowStart(); $r .= $this->showfieldc($lang['ExpenseDeduction'],0,"deduction"); $check = ""check_all_float(this,'".$lang['DecPoint']."');\""; $r .= ' <td colspan="5"><input id="deduction" size="10" maxlength="10" name="deduction" '.$check.' value="'. my_number_format($this->obj->deduction,2) ."\" />\n"; $r .= " </td>\n"; - $r .= "</tr>\n"; + $r .= $this->EditRowEnd(); - $r .= "<tr>\n"; + $r .= $this->EditRowStart(); $r .= $this->showfieldc($lang['ExpenseStartTime'],1,"t_start"); $r .= " <td colspan=\"2\">\n"; $r .= $this->obj->t_start->EnterDateTime("t_start"); @@ -153,33 +158,30 @@ } else { $r .= " <td colspan=\"3\"> </td>\n"; } - $r .= "</tr>\n"; + $r .= $this->EditRowEnd(); if (!isset($this->hide['mop']) || !$this->hide['mop'] ) { - $r .= "<tr>\n"; + $r .= $this->EditRowStart(); $r .= $this->showfieldc($lang['ExpenseMOP'],0,"mop"); - $r .= " <td colspan=\"5\">\n"; - $r .= $this->obj->askMOP(); - $r .= " </td>\n"; - $r .= "</tr>\n"; + $r .= $this->showData($this->obj->askMOP(),$this->width-1); + $r .= $this->EditRowEnd(); } else { $this->addhidden("mop",-1); } if (!isset($this->hide['city']) || !$this->hide['city'] ) { - $r .= "<tr>\n"; + $r .= $this->EditRowStart(); $r .= $this->showfieldc($lang['City'],0,"city"); - $r .= ' <td colspan="5"><input id="city" size="80" maxlength="'. $table['expense']['city'][size] .'" name="city" value="'. myentities($this->obj->city) ."\" /></td>\n"; - $r .= "</tr>\n"; + $r .= $this->showData('<input id="city" size="80" maxlength="'. $table['expense']['city'][size] .'" name="city" value="'. myentities($this->obj->city) .'">',$this->width-1); + $r .= $this->EditRowEnd(); } if (!isset($this->hide['country']) || !$this->hide['country'] ) { - $r .= "<tr>\n"; + $r .= $this->EditRowStart(); $r .= $this->showfieldc($lang['Country'],0,"country"); - $r .= "<td colspan=\"5\">\n"; - $r .= SelectCntryCde("country", $this->obj->country); - $r .= " </td>\n"; - $r .= "</tr>\n"; + $r .= $this->showData(SelectCntryCde("country", $this->obj->country),$this->width-1); + $r .= $this->EditRowEnd(); } - $r .= "<tr>\n"; + + $r .= $this->EditRowStart(); $r .= $this->showfieldc($lang['ExpenseCCentre'],0,"ccentre"); $r .= "<td colspan=\"5\">\n"; if (!isset($this->fixate['ccentre']) || !$this->fixate['ccentre'] ) { @@ -189,12 +191,12 @@ $this->addhidden("ccentre",$this->obj->ccentre); } $r .= " </td>\n"; - $r .= "</tr>\n"; + $r .= $this->EditRowEnd(); - $r .= "<tr>\n"; + $r .= $this->EditRowStart(); $r .= $this->showfield($lang['ExpenseDescription'],0,"description"); - $r .= ' <td colspan="5"><textarea id="description" rows="10" cols="60" name="description">'. $this->obj->description ."</textarea></td>\n"; - $r .= "</tr>\n"; + $r .= $this->showData('<textarea id="description" rows="10" cols="60" name="description">'. $this->obj->description .'</textarea>',$this->width-1); + $r .= $this->EditRowEnd(); // Edit additional custom fields $r .= edit_custom_fields($this,$this->obj->gettype(),$this->obj,$this->width); @@ -326,4 +328,4 @@ <!-- SVN Info $Id$ $Author$ ---> +--> \ No newline at end of file Modified: trunk/php/expense/expense_overview.php =================================================================== --- trunk/php/expense/expense_overview.php 2017-07-08 15:54:00 UTC (rev 1306) +++ trunk/php/expense/expense_overview.php 2017-07-28 13:48:59 UTC (rev 1307) @@ -140,6 +140,11 @@ $this->flds++; $this->preflds++; } + if ($this->head['state']) { + $r .= $this->orderHeader('',$lang['ExpenseState'],$this->link2); + $this->flds++; + $this->preflds++; + } if ($this->head['supplier']) { $r .= $this->orderHeader('',$lang['ExpenseSupplier'],$this->link2); $this->flds++; @@ -202,6 +207,11 @@ $r .= $this->OverviewRowBlock($b->getRefLink($x),'over_l'); } + if ($this->head['state']) { + $x = ''; + $r .= $this->OverviewRowBlock($b->getState(),'over_l'); + } + if ($this->head['supplier']) { $x = ''; if (is_object($b->supplier)) { @@ -283,6 +293,11 @@ $r .= ' <option value="-1" selected="selected">'. $lang['ActionNil'] ."</option>\n"; $r .= ' <option value="-2">'. $lang['Delete'] ."</option>\n"; $r .= ' <option value="-4">'. $lang['AclModify'] ."</option>\n"; + foreach ($this->stc->states as $f) { + if ($f->stc_state == STC_NOT_EXISTANT) continue; + $r .= " <option value=\"S". $f->stc_state .'" style="background:'.$f->color.';">'. sprintf($lang['SetTo'],$lang['ExpenseState'],$f->getFullName()) ."</option>\n"; + } + $r .= get_custom_massupdate_options($this,'expense'); if (class_exists('watchlist')) { $r .= watchlist::action_options(); } @@ -299,8 +314,14 @@ * action via massupdate */ Function action() { - global $lang,$msg,$info; + global $lang,$msg,$info,$tutos; + $this->stc = getObject($this->user->dbconn,$tutos['expense_state_stc']); + if (!is_object($this->stc)) { + $this->stc = new stc(null); + $this->stc->initByArray('ExpenseStates',Expense::$c_state); + } + if ( $_GET['action'] == -2 ) { $this->dbconn->Begin("WORK"); foreach ($_GET['mark'] as $key => $val) { @@ -325,6 +346,52 @@ $this->redirect = "../". acl_action(); return; } + if ( preg_match("#^([S])(.*)#",$_GET['action'],$a) ) { + // Setting State + $this->dropSubSession(); + + $this->dbconn->Begin("WORK"); + foreach ($_GET['mark'] as $val) { + $b = new expense($this->dbconn); + $b = $b->read($val,$b); + if ( $b->id != $val ) { + continue; + } + if ( $b->mod_ok() ) { + $this->stc->stateowner = $b; + if ( $a[1] == "S" ) { + if ($a[2] == $b->state) continue; // keep + if (!$this->stc->check_trans($b->state,$a[2])) { + $msg = addLine($msg,$b->getLink() .': '. sprintf($lang['Err0024'],$lang[$b->getType()]).' ('.$lang['ExpenseState'].')'); + continue; + } + $state = $b->state; + if ($b->setState($a[2])) { + $info = addLine($info,$b->getLink() .' '. $lang['ExpenseState'] .': '.$lang['ExpenseStates'][$state].' → '. $lang['ExpenseStates'][$a[2]]); + } + } else { + $msg = addLine($msg,"A:".$_GET['action'] ." M: '". $val[1] ."' V:". $val[2]); + } + $msg = addLine($msg,$b->save()); + } else { + $msg = addLine($msg,$b->getLink() .': '. sprintf($lang['Err0024'],$lang[$b->getType()])); + } + unset ($b); + } + $this->dbconn->Commit("WORK"); + return; + } + + foreach ($_GET['mark'] as $key => $val) { + $obj = new expense($this->dbconn); + $obj = $obj->read($val,$obj); + if ( $obj->id != $val ) { + continue; + } + if (set_custom_massupdate_object($this,'expense',$obj,$_REQUEST['action'])) { + $msg = addLine($msg,$obj->save()); + } + } if (class_exists('watchlist')) { watchlist::parse_action($this->user); } @@ -334,7 +401,7 @@ * prepare */ Function prepare() { - global $msg,$lang,$table; + global $msg,$lang,$table,$tutos; $this->layout_id = useexpenses; $this->name = $lang['ExpensesOverview']; @@ -345,9 +412,16 @@ $this->stop = true; } + $this->stc = getObject($this->user->dbconn,$tutos['expense_state_stc']); + if (!is_object($this->stc)) { + $this->stc = new stc(null); + $this->stc->initByArray('ExpenseStates',Expense::$c_state); + } + $this->link1 = 'expense/expense_overview.php'; $this->filter = array(); + $this->head['state'] = true; $this->head['link_id'] = true; $this->head['custom'] = true; $this->head['mods'] = true; @@ -368,6 +442,9 @@ if (isset($this->hide['mods']) && $this->hide['mods'] ) { $this->head['mods'] = false; } + if (isset($this->hide['state']) && $this->hide['state'] ) { + $this->head['state'] = false; + } $this->link1 = addHiddenFields($this->link1); if (isset($_GET['ext'])) { @@ -384,19 +461,13 @@ $name = $_GET['name']; } + $this->header = ''; + $this->hpre = ''; + $j = "SELECT DISTINCT e.* FROM ". $this->dbconn->prefix .$table['expense'][name].' e '; // select + join $q = ""; $pre = " WHERE "; - if ( ($name != "*") && ($name != "") ) { - $q .= " " . $pre ."(". $this->dbconn->Like("e.name",$name) ." OR ". $this->dbconn->Like("e.name",$name) .")"; - $pre = " AND "; - $this->link1 = addUrlParameter($this->link1,"name=".UrlEncode($name)); - $this->filter['name'] = $name; - } else { - $this->filter['name'] = ""; - } - if ( isset($_GET['id']) ) { if (false == is_numeric($_GET['id'])) { $msg = addLine($msg,sprintf($lang['Err0012'],"id",$_GET['id'])); @@ -412,6 +483,8 @@ $q .= " ". $pre ." e.currency = '".$_GET['currency']."'"; $pre = " AND "; $this->link1 = addUrlParameter($this->link1,"currency=". $_GET['currency']); + $this->header .= $this->hpre.$lang['Currency'] .' = ' .myentities($_GET['currency']); + $this->hpre = '<br />'; } // References to display @@ -421,31 +494,38 @@ $this->q = $j.$q; $this->qpre = $pre; - // Start Date for search - overview_arg($this,'f',OVERVIEW_ARG_D_FROM,'expense',array('creation','t_start'),'created','e.'); - // End Date for search - overview_arg($this,'t',OVERVIEW_ARG_D_TO,'expense',array('creation','t_start'),'created','e.'); + // Name + overview_arg($this,'name',OVERVIEW_ARG_STRING,'expense',array('name'),'ExpenseName','e.'); - // reference - overview_arg($this,'link_fn',OVERVIEW_ARG_FN,'expense',array('link_id'),'ExpenseReference','e.',get_parent_classes('expense')); - overview_arg($this,'link_id',OVERVIEW_ARG_OBJID,'expense',array('link_id'),'ExpenseReference','e.'); + if($_REQUEST['ext'] == 1) { + // State + overview_arg($this,'state',OVERVIEW_ARG_INT,'expense',array('state'),array('ExpenseState','ExpenseStates'),'e.'); - // supplier - overview_arg($this,'supfn',OVERVIEW_ARG_FN,'expense',array('supplier'),'ExpenseSupplier','e.','cd'); - overview_arg($this,'supid',OVERVIEW_ARG_OBJID,'expense',array('supplier'),'ExpenseSupplier','e.'); + // Start Date for search + overview_arg($this,'f',OVERVIEW_ARG_D_FROM,'expense',array('creation','t_start'),'created','e.'); + // End Date for search + overview_arg($this,'t',OVERVIEW_ARG_D_TO,'expense',array('creation','t_start'),'created','e.'); - // adr - overview_arg($this,'adrfn',OVERVIEW_ARG_FN,'expense',array('adr_id'),'ExpenseAddress','e.','at'); - overview_arg($this,'adrid',OVERVIEW_ARG_OBJID,'expense',array('adr_id'),'ExpenseAddress','e.'); + // reference + overview_arg($this,'link_fn',OVERVIEW_ARG_FN,'expense',array('link_id'),'ExpenseReference','e.',get_parent_classes('expense')); + overview_arg($this,'link_id',OVERVIEW_ARG_OBJID,'expense',array('link_id'),'ExpenseReference','e.'); - // creator - overview_arg($this,'crfn',OVERVIEW_ARG_FN,'expense',array('creator'),'ExpenseCreator','e.','a'); - overview_arg($this,'crid',OVERVIEW_ARG_OBJID,'expense',array('creator'),'ExpenseCreator','e.'); + // supplier + overview_arg($this,'supfn',OVERVIEW_ARG_FN,'expense',array('supplier'),'ExpenseSupplier','e.','cd'); + overview_arg($this,'supid',OVERVIEW_ARG_OBJID,'expense',array('supplier'),'ExpenseSupplier','e.'); - // category - overview_arg($this,'cat',OVERVIEW_ARG_INT,'expense',array('category'),array('ExpenseCategory','ExpenseCategories'),'e.'); + // adr + overview_arg($this,'adrfn',OVERVIEW_ARG_FN,'expense',array('adr_id'),'ExpenseAddress','e.','at'); + overview_arg($this,'adrid',OVERVIEW_ARG_OBJID,'expense',array('adr_id'),'ExpenseAddress','e.'); + // creator + overview_arg($this,'crfn',OVERVIEW_ARG_FN,'expense',array('creator'),'ExpenseCreator','e.','a'); + overview_arg($this,'crid',OVERVIEW_ARG_OBJID,'expense',array('creator'),'ExpenseCreator','e.'); + // category + overview_arg($this,'cat',OVERVIEW_ARG_INT,'expense',array('category'),array('ExpenseCategory','ExpenseCategories'),'e.'); + } + // custom selectors // get customized non textual search fields $custom = get_custom_sql_select($this,'expense','e',$this->link1); @@ -460,7 +540,6 @@ $this->q = preg_replace('# where#i',','.$s.' WHERE',$this->q); } // $msg = addLine($this->q,$msg); - check_dbacl($this->dbconn,$this->q, $this->user->id); // sorting @@ -510,4 +589,4 @@ $l = new Expense_overview($current_user); $l->display(); $dbconn->Close(); -?> +?> \ No newline at end of file Modified: trunk/php/expense/expense_select.php =================================================================== --- trunk/php/expense/expense_select.php 2017-07-08 15:54:00 UTC (rev 1306) +++ trunk/php/expense/expense_select.php 2017-07-28 13:48:59 UTC (rev 1307) @@ -1,6 +1,6 @@ <?php /** - * Copyright 1999 - 2013 by Gero Kohnert and ECOsoft.net + * Copyright 1999 - 2017 by Gero Kohnert and ECOsoft.net * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -58,6 +58,11 @@ $r .= $this->ContentRowEnd(); $r .= $this->ContentRowStart('ext'); + $r .= $this->showfieldc($lang['ExpenseState'],0,'state'); + $r .= $this->showdata(ExpenseAskState($this->state),2); + $r .= $this->ContentRowEnd(); + + $r .= $this->ContentRowStart('ext'); $r .= $this->showfieldc($lang['ExpenseSupplier'],0,'sup'); $r .= $this->showdata(select_from_array_or_input($this,"sup",null,1,'cd'),2); $r .= $this->ContentRowEnd(); @@ -165,16 +170,11 @@ $this->ext = $_GET['ext']; } - # $lang['ExpenseReferences'][1] = &$lang['Company']; - # $lang['ExpenseReferences'][2] = &$lang['Department']; - # $lang['ExpenseReferences'][3] = &$lang['Address']; - # $lang['ExpenseReferences'][4] = &$lang['Bug']; - $lang['ExpenseReferences'][5] = &$lang['ProductP']; - # $lang['ExpenseReferences'][6] = &$lang['Team']; - $lang['ExpenseReferences'][7] = &$lang['Task']; - # $lang['ExpenseReferences'][8] = &$lang['Installation']; - $lang['ExpenseReferences'][8] = 'Installation'; - # $lang['ExpenseReferences'][9] = &$lang['Checklist']; + if ( isset($_SESSION['expense_state']) ) { + $this->state = $_SESSION['expense_state']; + } else { + $this->state = EXPENSE_STATE_UNDEF; + } } } @@ -185,4 +185,4 @@ <!-- SVN Info $Id$ $Author$ ---> +--> \ No newline at end of file Modified: trunk/php/expense/expense_show.php =================================================================== --- trunk/php/expense/expense_show.php 2017-07-08 15:54:00 UTC (rev 1306) +++ trunk/php/expense/expense_show.php 2017-07-28 13:48:59 UTC (rev 1307) @@ -1,6 +1,6 @@ <?php /** - * Copyright 1999 - 2013 by Gero Kohnert and ECOsoft.net + * Copyright 1999 - 2017 by Gero Kohnert and ECOsoft.net * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -54,6 +54,11 @@ $r .= $this->ContentRowEnd(); $r .= $this->ContentRowStart(); + $r .= $this->showfield($lang['ExpenseState']); + $r .= $this->showdata($this->obj->getState(),$this->width -1); + $r .= $this->ContentRowEnd(); + + $r .= $this->ContentRowStart(); $r .= $this->showfield($lang['ExpenseReference']); $r .= $this->showdata($this->obj->getRefLink(),$this->width -1); $r .= $this->ContentRowEnd(); Modified: trunk/php/expense/mconfig.pinc =================================================================== --- trunk/php/expense/mconfig.pinc 2017-07-08 15:54:00 UTC (rev 1306) +++ trunk/php/expense/mconfig.pinc 2017-07-28 13:48:59 UTC (rev 1307) @@ -1,6 +1,6 @@ <?php /* - * Copyright 1999 - 2013 by Gero Kohnert and ECOsoft.net + * Copyright 1999 - 2017 by Gero Kohnert and ECOsoft.net * * Module specific configuration * @@ -9,10 +9,10 @@ */ $tutos['files'][__FILE__] = '$Rev$'; -# -# Every module must have an individual ID ( < 0 > -100 ). -# this is module 90 -# +// +// Every module must have an individual ID ( < 0 > -100 ). +// this is module 90 +// define('useexpenses',-90); $tutos[modules]['expense'] = array( name => "expense", @@ -19,23 +19,27 @@ Desc => "expenses", file => "php/expense/expense.pinc", 'overview' => "expense/expense_overview.php", + 'configurl' => "expense/expense_config.php", 'perm' => useexpenses ); -# -# globally enable this module -# +// +// globally enable this module +// $tutos[useexpenses] = 1; -# -# List of objects/modules where we do something with this module -# and need to include this module -# +$tutos['expense_state_stc'] = -1; + +// +// List of objects/modules where we do something with this module +// and need to include this module +// $tutos[modulesinc]['expense'][] = "product"; $tutos[modulesinc]['expense'][] = "task"; $tutos[modulesinc]['expense'][] = "installation"; $tutos[modulesinc]['expense'][] = "scheme"; -# -# Files (like invoices etc) could be added -# +$tutos[modulesinc]['expense'][] = 'stc'; +// +// Files (like invoices etc) could be added +// $tutos[modulesinc]['file'][] = "expense"; $tutos['docowners'][] = 'expense'; Modified: trunk/php/expense/mtable.pinc =================================================================== --- trunk/php/expense/mtable.pinc 2017-07-08 15:54:00 UTC (rev 1306) +++ trunk/php/expense/mtable.pinc 2017-07-28 13:48:59 UTC (rev 1307) @@ -1,6 +1,6 @@ <?php /** - * Copyright 1999 - 2011 by Gero Kohnert and ECOsoft.net + * Copyright 1999 - 2017 by Gero Kohnert and ECOsoft.net * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -19,6 +19,7 @@ $table['expense']['link_id'] = array(type => 'ID_TYPE', constraints => 'NN', Desc => 'id of linked object'); $table['expense']['adr_id'] = array(type => 'ID_TYPE', constraints => 'NN', Desc => 'id of linked address'); $table['expense']['name'] = array(type => 'VARCHAR', size => 50, constraints => 'NN', Desc => 'short name of expenses'); +$table['expense']['state'] = array(type => 'ID_TYPE', constraints => 'NN', Desc => 'state of expense'); $table['expense']['description'] = array(type => 'TX_TYPE', constraints => '', Desc => 'long description of expenses', 'hideempty' => true, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gok...@us...> - 2017-07-08 15:54:04
|
Revision: 1306 http://sourceforge.net/p/tutos/code/1306 Author: gokohnert Date: 2017-07-08 15:54:00 +0000 (Sat, 08 Jul 2017) Log Message: ----------- url handling handler Modified Paths: -------------- trunk/php/address_tools.p3 trunk/php/company_show.php trunk/php/handler.pinc trunk/php/location.pinc Modified: trunk/php/address_tools.p3 =================================================================== --- trunk/php/address_tools.p3 2017-07-08 12:09:31 UTC (rev 1305) +++ trunk/php/address_tools.p3 2017-07-08 15:54:00 UTC (rev 1306) @@ -19,9 +19,14 @@ Function Show_LocFields($user,$title,tutos_base $a,$name,$typ) { global $tutos,$lang,$current_user,$table; - if ( !isset($table['location'][$name]['hideempty']) ) { - $table['location'][$name]['hideempty'] = false; + // name might be _fld_name so short it + $fldname = $name; + if (strpos($name,'_fld_') === 0 ) { + $fldname = substr($name,5); } + if ( !isset($table['location'][$fldname]['hideempty']) ) { + $table['location'][$fldname]['hideempty'] = false; + } $used = false; $r = ''; $line = ''; @@ -40,36 +45,11 @@ foreach($a->location as $j => $l) { $r .= ' <td colspan="'. $s .'" class="over_l line'. (($line % 2) +1) ."\">\n"; $line++; - if ( $name == "email_1" ) { - $r .= handle('email',$l->$name,myentities($l->$name)); - if ($l->$name != '') { - $used = true; - } - } elseif ( $name == "email_2" ) { - $r .= handle('email',$l->$name,myentities($l->$name)); - if ($l->$name != '') { - $used = true; - } - } elseif ( $name == "phone_1" ) { - $r .= handle('phone',$l->$name,myentities($l->$name)); - if ($l->$name != '') { - $used = true; - } - } elseif ( $name == "phone_2" ) { - $r .= handle('phone',$l->$name,myentities($l->$name)); - if ($l->$name != '') { - $used = true; - } - } elseif ( $name == "zip" ) { + if ( $name == "zip" ) { $r .= handle('geodata',$l,myentities($l->$name)); if ($l->$name != '') { $used = true; } - } elseif ( $name == "fax_1" ) { - $r .= handle('fax',$l->$name,myentities($l->$name)); - if ($l->$name != '') { - $used = true; - } } elseif ( $name == "c_id" ) { if (is_object($l->company) && $l->company->id > 0) { $r .= $l->company->getLink(); @@ -105,7 +85,11 @@ mywindow.location.href = '". $url ."'; mywindow.focus();\" "self.status='". myentities($l->lname,1) ."' ;return true\" title=\"". myentities($l->lname) ."\">"; $r .= myentities($l->$name) ."</a>"; } else { - $r .= myentities($l->$name); + if ( isset($table['location'][$fldname]['handler']) ) { + $r .= handle($table['location'][$fldname]['handler'],$l->$name,myentities($l->$name)); + } else { + $r .= myentities($l->$name); + } if ($l->$name != '') { $used = true; } @@ -119,15 +103,15 @@ } } elseif ( $typ == 9 ) { $used = true; - if ( count($a->obj->location) <= 1 ) { + if ( count($a->location) <= 1 ) { $s = 2; } else { $s = 1; } - if ( count($a->obj->location) > 0 ) { - foreach($a->obj->location as $j => $l) { + if ( count($a->location) > 0 ) { + foreach($a->location as $j => $l) { if ( $name == "ModifyDelete" ) { - $r .= $current_user->layout->showGuiIcons('<th colspan="'.$s.'" align="right">'. myentities($l->lname) .' '. $lang['Address'] .'  ','</th>',$l,$a->obj,array('mod','del'),false); + $r .= $current_user->layout->showGuiIcons('<th colspan="'.$s.'" align="right">'. myentities($l->lname) .' '. $lang['Address'] .'  ','</th>',$l,$a,array('mod','del'),false); } } } @@ -163,7 +147,7 @@ $r .= "</tr>\n"; // sent only if hideempty false or fideempty true and content ist there - if (! $used && $table['location'][$name]['hideempty'] ) { + if (! $used && $table['location'][$fldname]['hideempty'] ) { return ''; } return $r; Modified: trunk/php/company_show.php =================================================================== --- trunk/php/company_show.php 2017-07-08 12:09:31 UTC (rev 1305) +++ trunk/php/company_show.php 2017-07-08 15:54:00 UTC (rev 1306) @@ -75,7 +75,7 @@ // Location's Header and Direkt Links to Modify and Delete // $r .= "<tr><td colspan=\"".$cols."\"></td></tr>\n"; // $r .= "<tr><td colspan=\"".$cols."\"></td></tr>\n"; - $r .= Show_LocFields($this->user,'',$this,"ModifyDelete",9); + $r .= Show_LocFields($this->user,'',$this->obj,"ModifyDelete",9); $r .= Show_LocFields($this->user,$lang['AdrDescription'],$this->obj,"lname",1); Modified: trunk/php/handler.pinc =================================================================== --- trunk/php/handler.pinc 2017-07-08 12:09:31 UTC (rev 1305) +++ trunk/php/handler.pinc 2017-07-08 15:54:00 UTC (rev 1306) @@ -1,6 +1,6 @@ <?php /** - * Copyright 2002 - 2013 by Gero Kohnert + * Copyright 2002 - 2017 by Gero Kohnert * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -16,7 +16,6 @@ */ Function handle($type,$obj,$arg) { global $tutos,$msg,$info; - $r = ''; $cnt = 0; if (!isset($tutos[handler][$type]) || (count($tutos[handler][$type]) == 0) ) { @@ -89,4 +88,24 @@ } } +/** + * show the content as url (used for fields that contain web urls) + */ +class url_handler extends tutos_handler +{ + /** + * run the handler + */ + function handle($obj,$arg,$cnt) { + return '<a href="'.$arg.'">'.$arg.'</a>'; + } + + /** + * check if all is ok + */ + function check($obj,$arg) { + return true; + } +} +$tutos[handler]['url']['url_handler'] = 'handler.pinc'; ?> \ No newline at end of file Modified: trunk/php/location.pinc =================================================================== --- trunk/php/location.pinc 2017-07-08 12:09:31 UTC (rev 1305) +++ trunk/php/location.pinc 2017-07-08 15:54:00 UTC (rev 1306) @@ -733,7 +733,7 @@ $r .= "</tr>\n"; // Edit additional custom fields - $r .= edit_custom_fields($layout,$this->gettype(),$this->obj,5); + $r .= edit_custom_fields($layout,$this->gettype(),$this,5); return $r; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gok...@us...> - 2017-07-08 12:09:33
|
Revision: 1305 http://sourceforge.net/p/tutos/code/1305 Author: gokohnert Date: 2017-07-08 12:09:31 +0000 (Sat, 08 Jul 2017) Log Message: ----------- use hideempty in locations Modified Paths: -------------- trunk/php/address_show.php trunk/php/address_tools.p3 trunk/php/db/table.pinc Modified: trunk/php/address_show.php =================================================================== --- trunk/php/address_show.php 2017-07-08 11:22:48 UTC (rev 1304) +++ trunk/php/address_show.php 2017-07-08 12:09:31 UTC (rev 1305) @@ -1,6 +1,6 @@ <?php /** - * Copyright 1999 - 2013 by Gero Kohnert + * Copyright 1999 - 2017 by Gero Kohnert * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -50,8 +50,8 @@ $r .= " ". myentities($this->obj->getFullName()) ."\n"; $r .= " ". myentities($this->obj->location[$this->lid]->street1) ."\n"; $r .= " ". myentities($this->obj->location[$this->lid]->street2) ."\n"; - #ToDo: localize this - $adrformat = "%s - %s %s"; + // ToDo: localize this + $adrformat = "%s - %s %s"; $r .= " ". sprintf($adrformat,$this->obj->location[$this->lid]->country , $this->obj->location[$this->lid]->zip , $this->obj->location[$this->lid]->city )."\n"; $r .= " ". $lang['countrycde'][$this->obj->location[$this->lid]->country] ."\n"; $r .= "\n\n\n"; @@ -145,6 +145,13 @@ $r .= Show_LocFields($this->user,$lang['ZIP'],$this->obj,"zip",1); $r .= Show_LocFields($this->user,$lang['State'],$this->obj,"state",1); $r .= Show_LocFields($this->user,$lang['Country'],$this->obj,"country",1); + // add custom location fields + foreach($table['location'] as $i => $x) { + if (!is_array($x)) continue; + if (!isset($x['custom'])) continue; + if (!$x['custom']) continue; + $r .= Show_LocFields($this->user,$x['lang'],$this->obj,'_fld_'.$i,1); + } $r .= team::infolist($this->user,$this->obj,$cols,$this->format); $r .= product::infolist($this->user,$this->obj,$cols,$this->format); Modified: trunk/php/address_tools.p3 =================================================================== --- trunk/php/address_tools.p3 2017-07-08 11:22:48 UTC (rev 1304) +++ trunk/php/address_tools.p3 2017-07-08 12:09:31 UTC (rev 1305) @@ -1,6 +1,6 @@ <?php /** - * Copyright 1999 - 2014 by Gero Kohnert + * Copyright 1999 - 2017 by Gero Kohnert * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -14,11 +14,15 @@ $tutos['files'][__FILE__] = '$Rev$'; /** --------------------------------------------------------------------------- - * + * show one location field vertically for all locations */ -Function Show_LocFields($user,$title,&$a,$name,$typ) { - global $tutos,$lang,$current_user; +Function Show_LocFields($user,$title,tutos_base $a,$name,$typ) { + global $tutos,$lang,$current_user,$table; + if ( !isset($table['location'][$name]['hideempty']) ) { + $table['location'][$name]['hideempty'] = false; + } + $used = false; $r = ''; $line = ''; $r .= "<tr>\n"; @@ -38,31 +42,60 @@ $line++; if ( $name == "email_1" ) { $r .= handle('email',$l->$name,myentities($l->$name)); + if ($l->$name != '') { + $used = true; + } } elseif ( $name == "email_2" ) { $r .= handle('email',$l->$name,myentities($l->$name)); + if ($l->$name != '') { + $used = true; + } } elseif ( $name == "phone_1" ) { $r .= handle('phone',$l->$name,myentities($l->$name)); + if ($l->$name != '') { + $used = true; + } } elseif ( $name == "phone_2" ) { $r .= handle('phone',$l->$name,myentities($l->$name)); + if ($l->$name != '') { + $used = true; + } } elseif ( $name == "zip" ) { $r .= handle('geodata',$l,myentities($l->$name)); + if ($l->$name != '') { + $used = true; + } } elseif ( $name == "fax_1" ) { $r .= handle('fax',$l->$name,myentities($l->$name)); + if ($l->$name != '') { + $used = true; + } } elseif ( $name == "c_id" ) { - if (is_object($l->company) && $l->company->id > 0) + if (is_object($l->company) && $l->company->id > 0) { $r .= $l->company->getLink(); + $used = true; + } } elseif ( $name == "d_id" ) { - if (is_object($l->department) && $l->department->id > 0) + if (is_object($l->department) && $l->department->id > 0) { $r .= $l->department->getLink($l->department->name); + $used = true; + } } elseif ( $name == "country" ) { if ( isset($lang['countrycde'][$l->$name]) ) { $r .= handle('country',$l,$lang['countrycde'][$l->$name] ." (". $l->$name .")"); } else { $r .= $l->$name; + if ($l->$name != '') { + $used = true; + } } } elseif ( $name == "city" ) { $r .= handle('city',$l,myentities($l->$name)); + if ($l->$name != '') { + $used = true; + } } elseif ( $name == "lname" ) { + $used = true; // always show lname $url = "address_show.php"; $url = addUrlParameter($url,"lid=". $l->id); $url = addUrlParameter($url,"format=popup",false); @@ -73,6 +106,9 @@ $r .= myentities($l->$name) ."</a>"; } else { $r .= myentities($l->$name); + if ($l->$name != '') { + $used = true; + } } $r .= "\n</td>\n"; $set++; @@ -82,6 +118,7 @@ $r .= ' <td colspan="'. $s ."\"> </td>\n"; } } elseif ( $typ == 9 ) { + $used = true; if ( count($a->obj->location) <= 1 ) { $s = 2; } else { @@ -121,8 +158,14 @@ } else { $r .= ' <td colspan="'. $s .'"> '. myentities($a->$name) ." </td>\n"; } + $used = true; } $r .= "</tr>\n"; + + // sent only if hideempty false or fideempty true and content ist there + if (! $used && $table['location'][$name]['hideempty'] ) { + return ''; + } return $r; } /** Modified: trunk/php/db/table.pinc =================================================================== --- trunk/php/db/table.pinc 2017-07-08 11:22:48 UTC (rev 1304) +++ trunk/php/db/table.pinc 2017-07-08 12:09:31 UTC (rev 1305) @@ -222,56 +222,75 @@ 'field' => 'phone_1', 'handler' => 'phone', 'lang' => 'Phone', + 'hideempty' => true, ), 'phone_2' => array(type => 'VARCHAR', size => 30, constraints => '', Desc => 'phone number', 'field' => 'phone_2', 'handler' => 'phone', 'lang' => 'MobilePhone', + 'hideempty' => true, ), 'fax_1' => array(type => 'VARCHAR', size => 30, constraints => '', Desc => 'fax number', 'field' => 'fax_1', 'handler' => 'fax', 'lang' => 'AdrFax', + 'hideempty' => true, ), 'email_1' => array(type => 'VARCHAR', size => 60, constraints => '', Desc => 'email address', 'field' => 'email_1', 'handler' => 'email', 'lang' => 'AdrEmail', + 'hideempty' => true, ), 'email_2' => array(type => 'VARCHAR', size => 60, constraints => '', Desc => 'email address', 'field' => 'email_2', 'handler' => 'email', 'lang' => 'AdrEmail', + 'hideempty' => true, ), 'street1' => array(type => 'VARCHAR', size => 30, constraints => '', Desc => 'street address', 'field' => 'street1', 'lang' => 'Street', + 'hideempty' => true, ), 'street2' => array(type => 'VARCHAR', size => 30, constraints => '', Desc => 'street address', 'field' => 'street2', 'lang' => 'Street', + 'hideempty' => true, ), 'city' => array(type => 'VARCHAR', size => 30, constraints => '', Desc => 'city', 'field' => 'city', 'lang' => 'City', + 'hideempty' => true, ), 'zip' => array(type => 'VARCHAR', size => 10, constraints => '', Desc => 'zip code', 'field' => 'zip', 'lang' => 'ZIP', + 'hideempty' => true, ), 'state' => array(type => 'VARCHAR', size => 30, constraints => '', Desc => 'state in country', 'field' => 'state', 'lang' => 'State', + 'hideempty' => true, ), 'country' => array(type => 'VARCHAR', size => 3, constraints => '', Desc => 'ISO Country code', 'field' => 'country', 'lang' => 'County', + 'hideempty' => true, ), 'coords' => array(type => 'VARCHAR', size => 30, constraints => '', Desc => 'Coordinates (not yet used)'), - 'acc_info1' => array(type => 'VARCHAR', size => 60, constraints => '', Desc => 'bank account info line 1'), - 'acc_info2' => array(type => 'VARCHAR', size => 60, constraints => '', Desc => 'bank account info line 2'), - 'acc_nr' => array(type => 'VARCHAR', size => 60, constraints => '', Desc => 'bank account info nr'), - 'customer_id' => array(type => 'VARCHAR', size => 60, constraints => '', Desc => 'customer id'), + 'acc_info1' => array(type => 'VARCHAR', size => 60, constraints => '', Desc => 'bank account info line 1', + 'hideempty' => true, + ), + 'acc_info2' => array(type => 'VARCHAR', size => 60, constraints => '', Desc => 'bank account info line 2', + 'hideempty' => true, + ), + 'acc_nr' => array(type => 'VARCHAR', size => 60, constraints => '', Desc => 'bank account info nr', + 'hideempty' => true, + ), + 'customer_id' => array(type => 'VARCHAR', size => 60, constraints => '', Desc => 'customer id', + 'hideempty' => true, + ), 'creator' => array(type => 'ID_TYPE', constraints => '', Desc => 'creator ID'), 'creation' => array(type => 'TS_TYPE', constraints => '', Desc => 'creation date') ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gok...@us...> - 2017-07-08 11:22:51
|
Revision: 1304 http://sourceforge.net/p/tutos/code/1304 Author: gokohnert Date: 2017-07-08 11:22:48 +0000 (Sat, 08 Jul 2017) Log Message: ----------- use custom location fields Modified Paths: -------------- trunk/php/department_show.php Modified: trunk/php/department_show.php =================================================================== --- trunk/php/department_show.php 2017-07-08 11:05:09 UTC (rev 1303) +++ trunk/php/department_show.php 2017-07-08 11:22:48 UTC (rev 1304) @@ -1,6 +1,6 @@ <?php /** - * Copyright 1999 - 2014 by Gero Kohnert + * Copyright 1999 - 2017 by Gero Kohnert * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -77,6 +77,13 @@ $r .= Show_LocFields($this->user,$lang['acc_info2'],$this->obj,"acc_info2",1); $r .= Show_LocFields($this->user,$lang['acc_nr'],$this->obj,"acc_nr",1); $r .= Show_LocFields($this->user,$lang['AdrCustumerID'],$this->obj,"customer_id",1); + // add custom location fields + foreach($table['location'] as $i => $x) { + if (!is_array($x)) continue; + if (!isset($x['custom'])) continue; + if (!$x['custom']) continue; + $r .= Show_LocFields($this->user,$x['lang'],$this->obj,'_fld_'.$i,1); + } } $ra = $this->dbconn->Exec($this->q); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gok...@us...> - 2017-07-08 11:05:10
|
Revision: 1303 http://sourceforge.net/p/tutos/code/1303 Author: gokohnert Date: 2017-07-08 11:05:09 +0000 (Sat, 08 Jul 2017) Log Message: ----------- use custom location fields Modified Paths: -------------- trunk/php/company_new.php trunk/php/company_show.php trunk/php/location.pinc Modified: trunk/php/company_new.php =================================================================== --- trunk/php/company_new.php 2017-06-30 14:14:13 UTC (rev 1302) +++ trunk/php/company_new.php 2017-07-08 11:05:09 UTC (rev 1303) @@ -58,7 +58,6 @@ $r .= $this->editfield_data_row($this->obj,$table['company']['credit_limit'],$this->width-1,1); $r .= $this->editfield_data_row($this->obj,$table['company']['employees'],$this->width-1,1); $r .= $this->editfield_data_row($this->obj,$table['company']['revenue'],$this->width-1,1); - #$r .= $this->showfield_data_row($this->obj,$table['company']['revenue'],$cols-1,1); // Edit additional custom fields $r .= edit_custom_fields($this,$this->obj->gettype(),$this->obj,$this->width); Modified: trunk/php/company_show.php =================================================================== --- trunk/php/company_show.php 2017-06-30 14:14:13 UTC (rev 1302) +++ trunk/php/company_show.php 2017-07-08 11:05:09 UTC (rev 1303) @@ -1,6 +1,6 @@ <?php /** - * Copyright 1999 - 2014 by Gero Kohnert + * Copyright 1999 - 2017 by Gero Kohnert * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -92,6 +92,13 @@ $r .= Show_LocFields($this->user,$lang['acc_info2'],$this->obj,"acc_info2",1); $r .= Show_LocFields($this->user,$lang['acc_nr'],$this->obj,"acc_nr",1); $r .= Show_LocFields($this->user,$lang['AdrCustumerID'],$this->obj,"customer_id",1); + // add custom location fields + foreach($table['location'] as $i => $x) { + if (!is_array($x)) continue; + if (!isset($x['custom'])) continue; + if (!$x['custom']) continue; + $r .= Show_LocFields($this->user,$x['lang'],$this->obj,'_fld_'.$i,1); + } } // No departments Modified: trunk/php/location.pinc =================================================================== --- trunk/php/location.pinc 2017-06-30 14:14:13 UTC (rev 1302) +++ trunk/php/location.pinc 2017-07-08 11:05:09 UTC (rev 1303) @@ -1,6 +1,6 @@ <?php /** - * Copyright 1999 - 2013 by Gero Kohnert + * Copyright 1999 - 2017 by Gero Kohnert * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -78,7 +78,6 @@ return; } - $obj->location = array(); $obj->locall = array(); @@ -590,6 +589,8 @@ } } } + // Parse additional custom fields + $msg = addLine($msg,parse_custom_fields($this->gettype(),$this)); if ( isset($_POST['cploc']) && ($_POST['cploc'] == 1) ) { // Copy the location data from the companies location if possible @@ -730,6 +731,10 @@ $r .= $layout->showfieldc($lang['AdrCustumerID'],0,"customer_id"); $r .= ' <td colspan="4"><input size="50" maxlength="'. $table['location']['customer_id'][size] .'" id="customer_id" name="customer_id" value="'. myentities($this->customer_id) ."\" /></td>\n"; $r .= "</tr>\n"; + + // Edit additional custom fields + $r .= edit_custom_fields($layout,$this->gettype(),$this->obj,5); + return $r; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |