fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [8992] property: approval and veendor email


From: Sigurd Nes
Subject: [Fmsystem-commits] [8992] property: approval and veendor email
Date: Mon, 19 Mar 2012 21:25:32 +0000

Revision: 8992
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8992
Author:   sigurdne
Date:     2012-03-19 21:25:31 +0000 (Mon, 19 Mar 2012)
Log Message:
-----------
property: approval and veendor email

Modified Paths:
--------------
    trunk/property/inc/class.bocommon.inc.php
    trunk/property/inc/class.soworkorder.inc.php
    trunk/property/inc/class.uitts.inc.php
    trunk/property/inc/class.uiwo_hour.inc.php
    trunk/property/inc/class.uiworkorder.inc.php
    trunk/property/setup/setup.inc.php
    trunk/property/templates/base/wo_hour.xsl
    trunk/property/templates/base/workorder.xsl

Modified: trunk/property/inc/class.bocommon.inc.php
===================================================================
--- trunk/property/inc/class.bocommon.inc.php   2012-03-18 21:07:15 UTC (rev 
8991)
+++ trunk/property/inc/class.bocommon.inc.php   2012-03-19 21:25:31 UTC (rev 
8992)
@@ -48,6 +48,7 @@
                var $public_functions = array
                        (
                                'confirm_session'       => true,
+                               'get_vendor_email'      => true
                        );
 
                function __construct()
@@ -2126,4 +2127,40 @@
                        }
                        return $ret;
                }
+
+               public function get_vendor_email($vendor_id = 0)
+               {
+                       if(!$vendor_id)
+                       {
+                               $vendor_id = phpgw::get_var('vendor_id', 'int', 
'GET', 0);
+                       }
+                       $vendor_email = 
execMethod('property.sowo_hour.get_email', $vendor_id);
+
+                       $content_email = array();
+                       $title =  lang('The address to which this order will be 
sendt');
+                       foreach($vendor_email as $_entry )
+                       {                               
+                               $content_email[] = array
+                                       (
+
+                                               'value_email'           => 
$_entry['email'],
+                                               'value_select'          => 
"<input type='checkbox' name='values[vendor_email][]' 
value='{$_entry['email']}' title='{$title}'>"
+                                       );
+                       }
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+
+                               if(count($content_email))
+                               {
+                                       return json_encode($content_email);
+                               }
+                               else
+                               {
+                                       return "";
+                               }
+                       }
+                       return $content_email;
+               }
+
        }

Modified: trunk/property/inc/class.soworkorder.inc.php
===================================================================
--- trunk/property/inc/class.soworkorder.inc.php        2012-03-18 21:07:15 UTC 
(rev 8991)
+++ trunk/property/inc/class.soworkorder.inc.php        2012-03-19 21:25:31 UTC 
(rev 8992)
@@ -1011,7 +1011,7 @@
                                        $workorder['key_fetch'],
                                        $workorder['vendor_id'],
                                        $workorder['charge_tenant'],
-                                       $this->account,
+                                       $workorder['user_id'] ? 
$workorder['user_id'] : $this->account,
                                        $workorder['ecodimb'],
                                        $workorder['cat_id'],
                                        $workorder['billable_hours'],
@@ -1138,6 +1138,7 @@
                                        'addition'                      => 
$workorder['addition_percentage'],
                                        'charge_tenant'         => 
$workorder['charge_tenant'],
                                        'vendor_id'                     => 
$workorder['vendor_id'],
+                                       'user_id'                       => 
$workorder['user_id'],
                                        'ecodimb'                       => 
$workorder['ecodimb'],
                                        'category'                      => 
$workorder['cat_id'],
                                        'billable_hours'        => 
$workorder['billable_hours'],

Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php      2012-03-18 21:07:15 UTC (rev 
8991)
+++ trunk/property/inc/class.uitts.inc.php      2012-03-19 21:25:31 UTC (rev 
8992)
@@ -51,7 +51,6 @@
                        'edit_status'           => true,
                        'edit_priority'         => true,
                        'update_data'           => true,
-                       'get_vendor_email'      => true,
                        '_print'                        => true,
                        'columns'                       => true
                );
@@ -2223,7 +2222,7 @@
                        switch($action)
                        {
                                case 'get_vendor':
-                                       return $this->get_vendor_email();
+                                       return 
$this->bocommon->get_vendor_email();
                                        break;
                                case 'get_files':
                                        return $this->get_files();
@@ -2280,41 +2279,7 @@
                }
 
 
-               function get_vendor_email($vendor_id = 0)
-               {
-                       if(!$vendor_id)
-                       {
-                               $vendor_id = phpgw::get_var('vendor_id', 'int', 
'GET', 0);
-                       }
-                       $vendor_email = 
execMethod('property.sowo_hour.get_email', $vendor_id);
 
-                       $content_email = array();
-                       $title =  lang('The address to which this order will be 
sendt');
-                       foreach($vendor_email as $_entry )
-                       {                               
-                               $content_email[] = array
-                                       (
-
-                                               'value_email'           => 
$_entry['email'],
-                                               'value_select'          => 
"<input type='checkbox' name='values[vendor_email][]' 
value='{$_entry['email']}' title='{$title}'>"
-                                       );
-                       }
-
-                       if( phpgw::get_var('phpgw_return_as') == 'json' )
-                       {
-
-                               if(count($content_email))
-                               {
-                                       return json_encode($content_email);
-                               }
-                               else
-                               {
-                                       return "";
-                               }
-                       }
-                       return $content_email;
-               }
-
                function view()
                {
                        if(!$this->acl_read)
@@ -3077,7 +3042,7 @@
                                );      
 
 
-                       $content_email = 
$this->get_vendor_email(isset($ticket['vendor_id'])?$ticket['vendor_id']:0);
+                       $content_email = 
$this->bocommon->get_vendor_email(isset($ticket['vendor_id'])?$ticket['vendor_id']:0);
 
                        $datavalues[3] = array
                                (

Modified: trunk/property/inc/class.uiwo_hour.inc.php
===================================================================
--- trunk/property/inc/class.uiwo_hour.inc.php  2012-03-18 21:07:15 UTC (rev 
8991)
+++ trunk/property/inc/class.uiwo_hour.inc.php  2012-03-19 21:25:31 UTC (rev 
8992)
@@ -1200,12 +1200,12 @@
                        $send_as_pdf    = phpgw::get_var('send_as_pdf', 'bool');
                        $email_receipt  = phpgw::get_var('email_receipt', 
'bool');
                        
-
+/*
                        if($update_email)
                        {
                                
$this->bo->update_email($to_email,$workorder_id);
                        }
-
+*/
                        $workorder = 
$this->boworkorder->read_single($workorder_id);
                        $workorder_history = 
$this->boworkorder->read_record_history($workorder_id);
 
@@ -1288,9 +1288,12 @@
                        $dateformat                             = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
                        $date                                   = 
$GLOBALS['phpgw']->common->show_date(time(),$dateformat);
 
-                       $from_name =    
$GLOBALS['phpgw_info']['user']['fullname'];
-                       $from_email =   
"{$from_name}<{$GLOBALS['phpgw_info']['user']['preferences']['property']['email']}>";
 
+                       
$GLOBALS['phpgw']->preferences->set_account_id($workorder['user_id'], true);
+
+                       $from_name =    
$GLOBALS['phpgw']->accounts->get($workorder['user_id'])->__toString();
+                       $from_email =   
"{$from_name}<{$GLOBALS['phpgw']->preferences->data['property']['email']}>";
+
                        if($this->config->config_data['wo_status_sms'])
                        {
                                $sms_location_id = 
$GLOBALS['phpgw']->locations->get_id('sms', 'run');
@@ -1381,10 +1384,10 @@
                                        'lang_from'                             
                => lang('From'),
                                        'from_name'                             
                => $from_name,
                                        'from_email'                            
        => $from_email,
-                                       'from_phone'                            
        => 
$GLOBALS['phpgw_info']['user']['preferences']['property']['cellphone'],
+                                       'from_phone'                            
        => $GLOBALS['phpgw']->preferences->data['property']['cellphone'],
                                        'lang_district'                         
        => lang('District'),
                                        'district'                              
                => $project['location_data']['district_id'],
-                                       'ressursnr'                             
                => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['ressursnr']) ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['ressursnr'] : '',
+                                       'ressursnr'                             
                => 
isset($GLOBALS['phpgw']->preferences->data['property']['ressursnr']) ? 
$GLOBALS['phpgw']->preferences->data['property']['ressursnr'] : '',
 
                                        'lang_to'                               
                => lang('To'),
                                        'to_name'                               
                => $workorder['vendor_name'],
@@ -1432,13 +1435,15 @@
                                        'order_footer'                          
        => $this->config->config_data['order_footer']
                                );
 
-                       if($send_order && !$to_email)
+                       if($send_order && !$to_email && 
!$workorder['mail_recipients'])
                        {
                                $receipt['error'][]=array('msg'=>lang('No 
mailaddress is selected'));
                        }
 
-                       if($to_email || $print)
+                       if($to_email || $print || 
($workorder['mail_recipients'] && $_POST['send_order']))
                        {
+                               $_to = $workorder['mail_recipients'] ? 
implode(';', $workorder['mail_recipients']) : $to_email;
+                               
                                $email_data['use_yui_table'] = false;
 
                                
$this->create_html->add_file(array(PHPGW_SERVER_ROOT . 
'/property/templates/base/wo_hour'));
@@ -1494,7 +1499,7 @@
                                        exit;
                                }
 
-                               
if($GLOBALS['phpgw_info']['user']['preferences']['property']['order_email_rcpt']==1)
+                               
if($GLOBALS['phpgw']->preferences->data['property']['order_email_rcpt']==1)
                                {
                                        $bcc = $from_email;
                                }
@@ -1547,7 +1552,7 @@
                                        {
                                                $GLOBALS['phpgw']->send = 
CreateObject('phpgwapi.send');
                                        }
-                                       $rcpt = 
$GLOBALS['phpgw']->send->msg('email', $to_email, $subject, $body, '', $cc, 
$bcc, $from_email, $from_name, 'html', '', $attachments, $email_receipt);
+                                       $rcpt = 
$GLOBALS['phpgw']->send->msg('email', $_to, $subject, $body, '', $cc, $bcc, 
$from_email, $from_name, 'html', '', $attachments, $email_receipt);
                                }
                                else
                                {
@@ -1558,7 +1563,7 @@
                                {
                                        $_attachment_log = $attachment_log ? 
"::$attachment_log" : '';
                                        $historylog     = 
CreateObject('property.historylog','workorder');
-                                       
$historylog->add('M',$workorder_id,"{$to_email}{$_attachment_log}");
+                                       
$historylog->add('M',$workorder_id,"{$_to}{$_attachment_log}");
                                        
$receipt['message'][]=array('msg'=>lang('Workorder is sent by email!'));
                                        if($attachment_log)
                                        {
@@ -1602,7 +1607,7 @@
                                {
                                        
$receipt['error'][]=array('msg'=>lang('The recipient did not get the email:'));
                                        
$receipt['error'][]=array('msg'=>lang('From') . ' ' . $from_email);
-                                       
$receipt['error'][]=array('msg'=>lang('To') . ' ' . $to_email);
+                                       
$receipt['error'][]=array('msg'=>lang('To') . ' ' . $_to);
                                }
                        }
 
@@ -1701,7 +1706,7 @@
                                        'lang_to_email_address_statustext'      
=> lang('The address to which this order will be sendt'),
                                        'to_email'                              
                        => $to_email,
                                        'email_list'                            
                => $email_list,
-                                       'requst_email_receipt'                  
        => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['request_order_email_rcpt'])
 && 
$GLOBALS['phpgw_info']['user']['preferences']['property']['request_order_email_rcpt']==1
 ? 1 : 0,
+                                       'requst_email_receipt'                  
        => 
isset($GLOBALS['phpgw']->preferences->data['request_order_email_rcpt']) && 
$GLOBALS['phpgw']->preferences->data['property']['request_order_email_rcpt']==1 
? 1 : 0,
                                        'lang_select_email'                     
                => lang('Select email'),
                                        'send_order_action'                     
                => $GLOBALS['phpgw']->link('/index.php',array(
                                                                                
                                                'menuaction'    => 
'property.uiwo_hour.view',
@@ -1745,7 +1750,8 @@
                                                                                
                                                        'show_cost'             
=> $show_cost,
                                                                                
                                                        'show_details'  => 
$show_details,
                                                                                
                                                        'preview'               
=> true,
-                                                                               
                                                        )) . "','100','100')"
+                                                                               
                                                        )) . "','100','100')",
+                                       'mail_recipients'                       
                => isset($workorder['mail_recipients']) && 
is_array($workorder['mail_recipients']) ? implode(';', 
$workorder['mail_recipients']) : ''
                                );
 
 
@@ -1772,9 +1778,6 @@
                        $function_msg   = $this->boworkorder->order_sent_adress 
? lang('ReSend order') :lang('Send order');
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
-                       //$GLOBALS['phpgw']->xslttpl->pp();
-                       //$this->save_sessiondata();
-
                }
 
 

Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php        2012-03-18 21:07:15 UTC 
(rev 8991)
+++ trunk/property/inc/class.uiworkorder.inc.php        2012-03-19 21:25:31 UTC 
(rev 8992)
@@ -1626,7 +1626,7 @@
                                );      
 
 
-                       $content_email =  
execMethod('property.uitts.get_vendor_email', isset($values['vendor_id']) ? 
$values['vendor_id'] : 0 );
+                       $content_email =  
execMethod('property.bocommon.get_vendor_email', isset($values['vendor_id']) ? 
$values['vendor_id'] : 0 );
                        
                        if(isset($values['mail_recipients']) && 
is_array($values['mail_recipients']))
                        {
@@ -1674,12 +1674,18 @@
                        $cat_sub = array_merge($catetory,$cat_sub);
 
                        $suppresscoordination                   = 
isset($config->config_data['project_suppresscoordination']) && 
$config->config_data['project_suppresscoordination'] ? 1 : '';
+                       $user_list = $this->bocommon->get_user_list('select', 
isset($values['user_id']) && $values['user_id'] ? $values['user_id'] : 
$this->account ,false,false,-1,false,false,'',-1);
+                       foreach ($user_list as &$user)
+                       {
+                               $user['id'] = $user['user_id'];
+                       }
+                       
+                       $value_coordinator = isset($project['coordinator']) ? 
$GLOBALS['phpgw']->accounts->get($project['coordinator'])->__toString() : 
$GLOBALS['phpgw']->accounts->get($this->account)->__toString();
 
-                       $value_user = isset($values['user_id']) ? 
$GLOBALS['phpgw']->accounts->get($values['user_id'])->__toString() : 
$GLOBALS['phpgw']->accounts->get($this->account)->__toString();
                        $data = array
                                (
                                        'mode'                                  
                                => $mode,
-                                       'value_user'                            
                        => $value_user,
+                                       'value_coordinator'                     
                        => $value_coordinator,
                                        'event_data'                            
                        => $event_data,
                                        'link_claim'                            
                        => $link_claim,
                                        'lang_claim'                            
                        => lang('claim'),
@@ -1806,8 +1812,7 @@
                                        'lang_coordinator'                      
                        => lang('Coordinator'),
                                        'lang_sum'                              
                                => lang('Sum'),
                                        'select_user_name'                      
                        => 'values[coordinator]',
-                                       'user_list'                             
                                => 
$this->bocommon->get_user_list('select',$project['coordinator'],$extra=false,$default=false,$start=-1,$sort=false,$order=false,$query='',$offset=-1),
-
+                                       'user_list'                             
                                => array('options' => $user_list),
                                        'status_list'                           
                        => 
$this->bo->select_status_list('select',$values['status']),
                                        'status_name'                           
                        => 'values[status]',
                                        'lang_no_status'                        
                        => lang('Select status'),
@@ -1850,7 +1855,7 @@
                                        'lang_upload_file'                      
                        => lang('Upload file'),
                                        'lang_file_statustext'                  
                => lang('Select file to upload'),
                                        'value_billable_hours'                  
                => $values['billable_hours'],
-                                       'base_java_url'                         
                        => 
"{menuaction:'property.uitts.get_vendor_email',phpgw_return_as:'json'}",
+                                       'base_java_url'                         
                        => 
"{menuaction:'property.bocommon.get_vendor_email',phpgw_return_as:'json'}",
                                        'base_java_notify_url'                  
                => 
"{menuaction:'property.notify.update_data',location_id:{$location_id},location_item_id:'{$id}'}",
                                        'edit_action'                           
                        => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'property.uiworkorder.edit', 'id' => $id)),
                                        'lang_edit_statustext'                  
                => lang('Edit this entry '),

Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php  2012-03-18 21:07:15 UTC (rev 8991)
+++ trunk/property/setup/setup.inc.php  2012-03-19 21:25:31 UTC (rev 8992)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.636';
+       $setup_info['property']['version']              = '0.9.17.637';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']               = 1;
        $setup_info['property']['app_group']    = 'office';

Modified: trunk/property/templates/base/wo_hour.xsl
===================================================================
--- trunk/property/templates/base/wo_hour.xsl   2012-03-18 21:07:15 UTC (rev 
8991)
+++ trunk/property/templates/base/wo_hour.xsl   2012-03-19 21:25:31 UTC (rev 
8992)
@@ -428,21 +428,13 @@
                                                                                
</xsl:when>
                                                                        
</xsl:choose>
                                                                        
<xsl:choose>
-                                                                               
<xsl:when test="email_list !=''">
+                                                                               
<xsl:when test="mail_recipients !=''">
                                                                                
        <tr>
                                                                                
                <td class="th_text" align="left">
                                                                                
                        <xsl:value-of select="lang_mail"/>
                                                                                
                </td>
                                                                                
                <td align="left">
-                                                                               
                        <xsl:variable name="lang_to_email_address_statustext">
-                                                                               
                                <xsl:value-of 
select="lang_to_email_address_statustext"/>
-                                                                               
                        </xsl:variable>
-                                                                               
                        <select name="to_email" class="forms" 
title="{$lang_to_email_address_statustext}">
-                                                                               
                                <option value="">
-                                                                               
                                        <xsl:value-of 
select="lang_select_email"/>
-                                                                               
                                </option>
-                                                                               
                                <xsl:apply-templates select="email_list"/>
-                                                                               
                        </select>
+                                                                               
                        <xsl:value-of select="mail_recipients"/>
                                                                                
                </td>
                                                                                
        </tr>
                                                                                
</xsl:when>
@@ -459,18 +451,6 @@
                                                                                
                        </input>
                                                                                
                </td>
                                                                                
        </tr>
-                                                                               
        <tr>
-                                                                               
                <td class="th_text" align="left">
-                                                                               
                        <xsl:value-of select="lang_update_email"/>
-                                                                               
                </td>
-                                                                               
                <td align="left">
-                                                                               
                        <input type="checkbox" name="update_email" value="true" 
onMouseout="window.status='';return true;">
-                                                                               
                                <xsl:attribute name="title">
-                                                                               
                                        <xsl:value-of 
select="lang_update_email_statustext"/>
-                                                                               
                                </xsl:attribute>
-                                                                               
                        </input>
-                                                                               
                </td>
-                                                                               
        </tr>
                                                                                
</xsl:otherwise>
                                                                        
</xsl:choose>
                                                                        <tr>

Modified: trunk/property/templates/base/workorder.xsl
===================================================================
--- trunk/property/templates/base/workorder.xsl 2012-03-18 21:07:15 UTC (rev 
8991)
+++ trunk/property/templates/base/workorder.xsl 2012-03-19 21:25:31 UTC (rev 
8992)
@@ -217,22 +217,24 @@
                                                                <td>
                                                                        
<xsl:value-of select="lang_coordinator"/>
                                                                </td>
-                                                               <xsl:for-each 
select="user_list">
-                                                                       
<xsl:choose>
-                                                                               
<xsl:when test="selected">
-                                                                               
        <td>
-                                                                               
                <xsl:value-of select="name"/>
-                                                                               
        </td>
-                                                                               
</xsl:when>
-                                                                       
</xsl:choose>
-                                                               </xsl:for-each>
-                                                       </tr>
+                                                               <td>
+                                                                       
<xsl:value-of select="value_coordinator"/>
+                                                               </td>
+                                                               </tr>
                                                        <tr>
                                                                <td>
                                                                        
<xsl:value-of select="php:function('lang', 'janitor')"/>
                                                                </td>
                                                                <td>
-                                                                       
<xsl:value-of select="value_user"/>
+                                                                       <select 
name="values[user_id]" class="forms" >
+                                                                               
<xsl:attribute name="title">
+                                                                               
        <xsl:value-of select="php:function('lang', 'janitor')"/>
+                                                                               
</xsl:attribute>
+                                                                               
<option value="">
+                                                                               
        <xsl:value-of select="php:function('lang', 'select')"/>
+                                                                               
</option>
+                                                                               
<xsl:apply-templates select="user_list/options"/>
+                                                                       
</select>
                                                                </td>
                                                        </tr>
                                                        <tr>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]