1) infolog supports now setting a price for projectmanager (like timesheet)

2) all projectmanager specific stuff is in a new tab which gets only displayed if a user has projectmanager run-rights (incl. times)
3) support to display the infolog status-icons in projectmanager
This commit is contained in:
Ralf Becker 2006-02-04 07:49:47 +00:00
parent 9f6740faa2
commit 04c44a735a
11 changed files with 190 additions and 222 deletions

View File

@ -450,7 +450,7 @@
{
$values['info_owner'] = $this->so->user;
}
if ($values['info_link_id'] && isset($values['info_from']) && empty($values['info_from']))
if ($info_from_set = ($values['info_link_id'] && isset($values['info_from']) && empty($values['info_from'])))
{
$values['info_from'] = $this->link_id2from($values);
}
@ -500,6 +500,8 @@
// notify the link-class about the update, as other apps may be subscribt to it
$this->link->notify_update('infolog',$info_id,$values);
}
if ($info_from_set) $values['info_from'] = '';
return $info_id;
}
@ -852,4 +854,26 @@
{
return $this->xmlrpc ? $GLOBALS['server']->categories($complete) : False;
}
/**
* Returm InfoLog (custom) status icons for projectmanager
*
* @param array $args array with id's in $args['infolog']
* @return array with id => icon pairs
*/
function pm_icons($args)
{
if (isset($args['infolog']) && count($args['infolog']))
{
$icons = $this->so->get_status($args['infolog']);
foreach((array) $icons as $id => $status)
{
if ($status && substr($status,-1) != '%')
{
$icons[$id] = 'infolog/'.$status;
}
}
}
return $icons;
}
}

View File

@ -74,6 +74,12 @@ class datasource_infolog extends datasource
'pe_used_time' => $data['info_used_time'],
'pe_resources' => count($data['info_responsible']) ? $data['info_responsible'] : array($data['info_owner']),
'pe_details' => $data['info_des'] ? nl2br($data['info_des']) : '',
'pl_id' => $data['pl_id'],
'pe_unitprice' => $data['info_price'],
'pe_planned_quantity' => $data['info_planned_time'] / 60,
'pe_planned_budget' => $data['info_planned_time'] / 60 * $data['info_price'],
'pe_used_quantity' => $data['info_used_time'] / 60,
'pe_used_budget' => $data['info_used_time'] / 60 * $data['info_price'],
);
}

View File

@ -282,6 +282,22 @@
return $this->data;
}
/**
* Read the status of the given infolog-ids
*
* @param array $ids array with id's
* @return array with id => status pairs
*/
function get_status($ids)
{
$this->db->select($this->info_table,'info_id,info_status',array('info_id'=>$ids),__LINE__,__FILE__);
while ($this->db->next_record())
{
$stati[$this->db->f(0)] = $this->db->f(1);
}
return $stati;
}
/**
* delete InfoLog entry $info_id AND the links to it
*

View File

@ -37,6 +37,14 @@
);
var $icons;
var $prefs;
/**
* @var boinfolog-object $bo
*/
var $bo;
/**
* @var bolink-object $link reference to instance of the link-class of bo
*/
var $link;
function uiinfolog( )
{
@ -465,6 +473,8 @@
*/
function edit($content = null,$action = '',$action_id=0,$type='',$referer='')
{
$tabs = 'description|links|delegation|project|customfields';
if (is_array($content))
{
//echo "uiinfolog::edit: content="; _debug_array($content);
@ -496,7 +506,6 @@
{
if (is_array($content['link_to']['to_id']) && count($content['link_to']['to_id']))
{
$first_link_to = $content['link_to']['to_id'];
if (strstr($content['info_link_id'],':') !== False)
{
$info_link_id = $content['info_link_id'];
@ -522,14 +531,39 @@
$content['msg'] = lang('InfoLog entry saved');
$content['js'] = "opener.location.href='".($link=$GLOBALS['egw']->link($referer,array('msg' => $content['msg'])))."';";
}
if ($info_id && $first_link_to) // writing links for a new entry
if ((int) $content['pm_id'] != (int) $content['old_pm_id'])
{
$this->link->link('infolog',$info_id,$first_link_to);
if ($info_link_id)
//echo "<p>pm_id changed: $content[old_pm_id] -> $content[pm_id]</p>\n";
// update links accordingly, if selected project changed
if ($content['pm_id'])
{
//echo "<p>this->link->link('infolog',{$content['link_to']['to_id']},'projectmanager',{$content['pm_id']});</p>";
$this->link->link('infolog',$content['link_to']['to_id'],'projectmanager',$content['pm_id']);
// making the project the selected link, if no other link selected
if (!$info_link_id || $info_link_id == 'projectmanager:'.$content['old_pm_id'])
{
$info_link_id = 'projectmanager:'.$content['pm_id'];
}
}
if ($content['old_pm_id'])
{
//echo "<p>this->link->unlink2(0,infolog,{$content['link_to']['to_id']},0,'projectmanager',{$content['old_pm_id']});</p>\n";
$this->link->unlink2(0,infolog,$content['link_to']['to_id'],0,'projectmanager',$content['old_pm_id']);
$content['old_pm_id'] = $content['pm_id'];
}
}
// writing links for a new entry
if ($info_id && is_array($content['link_to']['to_id']) && count($content['link_to']['to_id']))
{
$this->link->link('infolog',$info_id,$content['link_to']['to_id']);
$content['link_to']['to_id'] = $info_id;
}
if (strstr($info_link_id,':') !== false) // updating info_link_id if necessary
{
list($app,$id) = explode(':',$info_link_id);
$link = $this->link->get_link('infolog',$info_id,$app,$id);
if ((int) $content['info_link_id'] != (int) $link['link_id'])
{
$content['info_link_id'] = $link['link_id'];
$to_write = array(
@ -539,6 +573,8 @@
'info_owner' => $content['info_owner'],
);
$this->bo->write($to_write,False);
// we need eg. the new modification date, for further updates
$content = array_merge($content,$to_write);
}
}
}
@ -669,7 +705,7 @@
switch ($action)
{
case 'sp':
$links = $this->bo->link->get_links('infolog',$parent['info_id'],'!'.$this->bo->link->vfs_appname);
$links = $this->link->get_links('infolog',$parent['info_id'],'!'.$this->link->vfs_appname);
foreach($links as $link)
{
$link_id = $this->link->link('infolog',$content['link_to']['to_id'],$link['app'],$link['id'],$link['remark']);
@ -681,6 +717,8 @@
}
break;
case 'projectmanager':
$pm_links = array($action_id);
case 'addressbook':
case 'projects':
case 'calendar':
@ -691,6 +729,10 @@
case '':
if ($info_id)
{
if (!isset($pm_links))
{
$pm_links = $this->link->get_links('infolog',$info_id,'projectmanager');
}
break; // normal edit
}
case 'new': // new entry
@ -704,14 +746,14 @@
$content['info_status'] = $this->bo->status['defaults'][$content['info_type']];
break;
}
// we allways need to set a non-empty/-zero primary, to make the radiobutton appear
$content['link_to']['primary'] = $content['info_link_id'] ? $content['info_link_id'] : '#';
if (!isset($this->bo->enums['type'][$content['info_type']]))
{
$content['info_type'] = 'note';
}
}
// we allways need to set a non-empty/-zero primary, to make the radiobutton appear
$content['link_to']['primary'] = $content['info_link_id'] ? $content['info_link_id'] : '#';
if (!($readonlys['button[delete]'] = !$info_id || !$this->bo->check_access($info_id,EGW_ACL_DELETE)))
{
$content['info_anz_subs'] = $this->bo->anzSubs($info_id); // to determine js confirmation of delete or not
@ -726,8 +768,15 @@
}
else
{
$readonlys['description|links|delegation|customfields'] = array('customfields' => true);
$readonlys[$tabs] = array('customfields' => true);
}
if (!isset($GLOBALS['egw_info']['user']['apps']['projectmanager']))
{
$readonlys[$tabs]['project'] = true; // disable the project tab
}
$old_pm_id = is_array($pm_links) ? array_shift($pm_links) : $content['old_pm_id'];
if (!isset($content['pm_id']) && $old_pm_id) $content['pm_id'] = $old_pm_id;
$GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '.
($content['status_only'] ? lang('Edit Status') : lang('Edit'));
$GLOBALS['egw_info']['flags']['params']['manual'] = array('page' => ($info_id ? 'ManualInfologEdit' : 'ManualInfologAdd'));
@ -748,7 +797,14 @@
'action_id' => $action_id,
'referer' => $referer,
'no_popup' => $no_popup,
'link_to' => array('to_id' => $content['link_to']['to_id']) // in case tab gets not viewed
'link_to' => array('to_id' => $content['link_to']['to_id']), // in case tab gets not viewed
'blur_title' => $content['blur_title'],
'old_pm_id' => $old_pm_id,
// preserv project fields, in case project tab is disabled, but user has rights to edit the entry
'pl_id' => $content['pl_id'],
'info_price' => $content['info_price'],
'info_used_time' => $content['info_used_time'],
'info_planned_time' => $content['info_planned_time'],
),$no_popup ? 0 : 2);
}
@ -786,7 +842,7 @@
if(get_var('save',Array('POST')))
{
$this->bo->link_pathes = $this->bo->send_file_ips = array();
$this->link_pathes = $this->bo->send_file_ips = array();
$valid = get_var('valid',Array('POST'));
$trans = get_var('trans',Array('POST'));
@ -795,12 +851,12 @@
{
if($val = stripslashes($val))
{
$this->bo->link_pathes[$val] = stripslashes($trans[$key]);
$this->link_pathes[$val] = stripslashes($trans[$key]);
$this->bo->send_file_ips[$val] = stripslashes($ip[$key]);
}
}
$this->bo->config->config_data = array(
'link_pathes' => $this->bo->link_pathes,
'link_pathes' => $this->link_pathes,
'send_file_ips' => $this->bo->send_file_ips
);
$this->bo->config->save_repository(True);
@ -826,11 +882,11 @@
if (!is_array($this->bo->send_file_ips))
{
$this->bo->send_file_ips = $this->bo->link_pathes = array();
$this->bo->send_file_ips = $this->link_pathes = array();
}
$i = 0; @reset($this->bo->link_pathes);
$i = 0; @reset($this->link_pathes);
do {
list($valid,$trans) = @each($this->bo->link_pathes);
list($valid,$trans) = @each($this->link_pathes);
$GLOBALS['egw']->template->set_var(array(
'tr_color' => $i & 1 ? 'row_off' : 'row_on',
'num' => $i+1,

File diff suppressed because one or more lines are too long

View File

@ -185,9 +185,11 @@ phone/email infolog de Telefon/Email
phonecall infolog de Telefonanruf
planned infolog de geplant
planned time infolog de geplante Zeit
price infolog de Preis
priority infolog de Priorität
private infolog de Privat
project infolog de Projekt
project settings: price, times infolog de Einstellungen zum Projekt: Preis, Zeiten
re: infolog de Re:
read one record by passing its id. infolog de Einen Datensatz spezifiziert durch seine id lesen.
reg. expr. for local ip's<br>eg. ^192\.168\.1\. infolog de reg. Ausdr. für lokale IP's<br>^192\.168\.1\.
@ -197,7 +199,7 @@ responsible infolog de verantwortlich
responsible open infolog de verantwortlich offen
responsible overdue infolog de verantwortlich überfällig
responsible upcoming infolog de verantwortlich zufünftig
responsible user, priority, times infolog de Verantwortlicher, Priorität, Zeiten
responsible user, priority infolog de Verantwortlicher, Priorität
returns a list / search for records. infolog de Liefert eine Liste von / sucht nach Datensätzen.
save infolog de Speichern
saves the changes made and leaves infolog de speichert die Änderungen und beendet
@ -206,7 +208,9 @@ search infolog de Suchen
search for: infolog de Suchen nach:
select infolog de Auswählen
select a category for this entry infolog de eine Kategorie für diesen Eintrag auswählen
select a price infolog de Preis auswählen
select a priority for this task infolog de eine Priorität für diesen Eintrag auswählen
select a project infolog de Projekt auswählen
select a responsible user: a person you want to delegate this task infolog de Verantwortlichen auswählen: Person(en) der Sie diese Aufgabe delegieren wollen
select a typ to edit it's status-values or delete it infolog de einen Type auswählen um seine Statuswerte zu ändern oder ihn zu löschen
select an app to search in infolog de eine Anwendung zum Durchsuchen auswählen

View File

@ -185,9 +185,11 @@ phone/email infolog en Phone/Email
phonecall infolog en Phone Call
planned infolog en planned
planned time infolog en planned time
price infolog en Price
priority infolog en Priority
private infolog en Private
project infolog en Project
project settings: price, times infolog en Project settings: price, times
re: infolog en Re:
read one record by passing its id. infolog en Read one record by passing its id.
reg. expr. for local ip's<br>eg. ^192\.168\.1\. infolog en reg. expr. for local IP's<br>eg. ^192\.168\.1\.
@ -197,7 +199,7 @@ responsible infolog en responsible
responsible open infolog en responsible open
responsible overdue infolog en responsible overdue
responsible upcoming infolog en responsible upcoming
responsible user, priority, times infolog en responsible user, priority, times
responsible user, priority infolog en responsible user, priority
returns a list / search for records. infolog en Returns a list / search for records.
save infolog en Save
saves the changes made and leaves infolog en saves the changes made and leaves
@ -206,7 +208,9 @@ search infolog en Search
search for: infolog en Search for:
select infolog en Select
select a category for this entry infolog en select a category for this entry
select a price infolog en Select a price
select a priority for this task infolog en select a priority for this task
select a project infolog en Select a project
select a responsible user: a person you want to delegate this task infolog en select a responsible user: a person you want to delegate this task
select a typ to edit it's status-values or delete it infolog en select a type to edit it's status-values or delete it
select an app to search in infolog en Select an App to search in

View File

@ -12,7 +12,7 @@
/* $Id$ */
$setup_info['infolog']['name'] = 'infolog';
$setup_info['infolog']['version'] = '1.2';
$setup_info['infolog']['version'] = '1.2.001';
$setup_info['infolog']['app_order'] = 5;
$setup_info['infolog']['tables'] = array('egw_infolog','egw_infolog_extra');
$setup_info['infolog']['enable'] = 1;
@ -60,6 +60,7 @@
$setup_info['infolog']['hooks']['calendar_include_todos'] = 'infolog.boinfolog.cal_to_include';
$setup_info['infolog']['hooks']['sidebox_menu'] = 'infolog.admin_prefs_sidebox_hooks.all_hooks';
$setup_info['infolog']['hooks']['search_link'] = 'infolog.infolog_link_registry.search_link';
$setup_info['infolog']['hooks']['pm_custom_app_icons'] = 'infolog.boinfolog.pm_icons';
/* Dependencies for this app to work */
$setup_info['infolog']['depends'][] = array(
@ -70,3 +71,5 @@
'appname' => 'etemplate',
'versions' => Array('1.0.0','1.0.1','1.2')
);

View File

@ -34,7 +34,9 @@
'info_confirm' => array('type' => 'varchar','precision' => '10','default' => 'not'),
'info_modifier' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
'info_link_id' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
'info_priority' => array('type' => 'int','precision' => '2','default' => '1')
'info_priority' => array('type' => 'int','precision' => '2','default' => '1'),
'pl_id' => array('type' => 'int','precision' => '4'),
'info_price' => array('type' => 'float','precision' => '8')
),
'pk' => array('info_id'),
'fk' => array(),

View File

@ -467,4 +467,21 @@
$GLOBALS['setup_info']['infolog']['currentver'] = '1.2';
return $GLOBALS['setup_info']['infolog']['currentver'];
}
$test[] = '1.2';
function infolog_upgrade1_2()
{
$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','pl_id',array(
'type' => 'int',
'precision' => '4'
));
$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_price',array(
'type' => 'float',
'precision' => '8'
));
return $GLOBALS['setup_info']['infolog']['currentver'] = '1.2.001';
}
?>

View File

@ -40,7 +40,7 @@
</rows>
</grid>
</template>
<template id="infolog.edit.delegation" template="" lang="" group="0" version="1.0.1.001">
<template id="infolog.edit.delegation" template="" lang="" group="0" version="1.2.001">
<grid width="100%" height="245">
<columns>
<column width="100"/>
@ -61,7 +61,7 @@
</row>
<row class="row" valign="top">
<description value="Responsible" options=",,,info_responsible"/>
<listbox type="select-account" rows="5" id="info_responsible" statustext="select a responsible user: a person you want to delegate this task"/>
<listbox type="select-account" rows="10" id="info_responsible" statustext="select a responsible user: a person you want to delegate this task"/>
</row>
<row class="row" disabled="1">
<description value="Confirm" options=",,,info_confirm"/>
@ -69,14 +69,35 @@
<menupopup id="info_confirm" statustext="do you want a confirmation of the responsible on: accepting, finishing the task or both"/>
</menulist>
</row>
</rows>
</grid>
</template>
<template id="infolog.edit.project" template="" lang="" group="0" version="1.2.001">
<grid width="100%" height="245">
<columns>
<column width="100"/>
<column/>
</columns>
<rows>
<row class="th">
<description span="all" value="Times"/>
<description span="all" value="Projectmanager"/>
</row>
<row class="row">
<description value="Project"/>
<projectmanager-select id="pm_id" onchange="1"/>
</row>
<row class="row">
<description value="Price"/>
<hbox span="all">
<projectmanager-pricelist id="pl_id" options="None" onchange="this.form['exec[info_price]'].value=this.options[this.selectedIndex].text.lastIndexOf('(') &lt; 0 ? '' : this.options[this.selectedIndex].text.slice(this.options[this.selectedIndex].text.lastIndexOf('(')+1,-1);"/>
<textbox type="float" id="info_price" span="all"/>
</hbox>
</row>
<row class="row">
<description options=",,,info_planned_time" value="planned time"/>
<date-duration id="info_planned_time"/>
</row>
<row class="row" valign="top">
<row class="row" valign="top" height="60%">
<description options=",,,info_used_time" value="used time"/>
<date-duration id="info_used_time"/>
</row>
@ -98,7 +119,7 @@
</rows>
</grid>
</template>
<template id="infolog.edit" template="" lang="" group="0" version="1.0.1.002">
<template id="infolog.edit" template="" lang="" group="0" version="1.2.001">
<grid width="100%">
<columns>
<column width="103"/>
@ -140,13 +161,15 @@
<tabs>
<tab label="Description" statustext="longer textual description"/>
<tab label="Links" statustext="Links of this entry"/>
<tab label="Delegation" statustext="responsible user, priority, times"/>
<tab label="Delegation" statustext="responsible user, priority"/>
<tab label="Projectmanager" statustext="Project settings: price, times"/>
<tab label="Customfields" statustext="Custom fields"/>
</tabs>
<tabpanels>
<template id="infolog.edit.description"/>
<template id="infolog.edit.links"/>
<template id="infolog.edit.delegation"/>
<template id="infolog.edit.project"/>
<template id="infolog.edit.customfields"/>
</tabpanels>
</tabbox>