fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8889] Merge 8882:8888 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [8889] Merge 8882:8888 from trunk
Date: Thu, 16 Feb 2012 09:32:48 +0000

Revision: 8889
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8889
Author:   sigurdne
Date:     2012-02-16 09:32:48 +0000 (Thu, 16 Feb 2012)
Log Message:
-----------
Merge 8882:8888 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php
    branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php
    
branches/Version-1_0-branch/controller/inc/component/class.calendar_builder.inc.php
    
branches/Version-1_0-branch/controller/inc/component/class.date_generator.inc.php
    
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_info.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.control.inc.php
    branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php
    branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
    branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php
    
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
    branches/Version-1_0-branch/property/js/yahoo/invoice.paid.index.js

Added Paths:
-----------
    
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_manager.inc.php
    
branches/Version-1_0-branch/controller/inc/helper/class.status_agg_month_info.inc.php

Property Changed:
----------------
    branches/Version-1_0-branch/


Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881
   + 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888

Modified: 
branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php   
2012-02-16 09:30:54 UTC (rev 8888)
+++ branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php   
2012-02-16 09:32:48 UTC (rev 8889)
@@ -806,7 +806,14 @@
        */
        function debug_xmlrpc($data = array())
        {
-               return $data;
+               if($data['fromdate'])
+               {
+                       return $data['fromdate'];
+               }
+               else
+               {
+                       return $data;
+               }
        }
 
        

Modified: branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php       
2012-02-16 09:30:54 UTC (rev 8888)
+++ branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php       
2012-02-16 09:32:48 UTC (rev 8889)
@@ -372,7 +372,6 @@
                $sql .= "FROM controller_check_list cl, controller_control c ";
                $sql .= "WHERE cl.location_code = '{$location_code}' ";
                $sql .= "AND c.id = $control_id ";
-               $sql .= "AND c.repeat_type < 2 ";
                $sql .= "AND cl.control_id = c.id ";
                $sql .= "AND cl.deadline >= $from_date_ts AND $to_date_ts > 
cl.deadline ";
                $sql .= "GROUP BY c.id";

Modified: branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php 
2012-02-16 09:30:54 UTC (rev 8888)
+++ branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php 
2012-02-16 09:32:48 UTC (rev 8889)
@@ -34,6 +34,7 @@
        include_class('controller', 'check_list', 'inc/model/');
        include_class('controller', 'check_item', 'inc/model/');
        include_class('controller', 'check_list_status_info', 'inc/helper/');
+       include_class('controller', 'status_agg_month_info', 'inc/helper/');
        include_class('controller', 'calendar_builder', 'inc/component/');
        include_class('controller', 'location_finder', 'inc/helper/');
                
@@ -117,10 +118,9 @@
                        $control_id_with_check_list_array = 
$this->so->get_check_lists_for_location_2($location_code, $from_date_ts, 
$to_date_ts);
                        
                        // Loops through all controls for location and 
populates controls with check lists
-                       $controls_with_check_list = 
$this->populate_controls_with_check_lists($controls_for_location_array, 
$control_id_with_check_list_array);
+                       $control_with_check_list_array = 
$this->populate_controls_with_check_lists($controls_for_location_array, 
$control_id_with_check_list_array);
                        
-                       $controls_calendar_array = array();
-                       $controls_calendar_array = 
$this->calendar_builder->build_calendar_array( $controls_calendar_array, 
$controls_with_check_list, $num_days_in_month, "view_days" );
+                       $controls_calendar_array = 
$this->calendar_builder->build_calendar_array( $control_with_check_list_array, 
$num_days_in_month, "view_days" );
                        
                        foreach($controls_calendar_array as &$inst)
                        {       
@@ -163,21 +163,6 @@
                        
self::render_template_xsl('calendar/view_calendar_month', $data);
                }
                
-               public function 
populate_controls_with_check_lists($controls_for_location_array, 
$control_id_with_check_list_array){
-                       $controls_with_check_list = array();
-                       
-                       foreach($controls_for_location_array as $control){
-                               foreach($control_id_with_check_list_array as 
$control_id){
-                                       if($control->get_id() == 
$control_id->get_id())
-                                               
$control->set_check_lists_array($control_id->get_check_lists_array());          
                                
-                               }
-                                       
-                               $controls_with_check_list[] = $control;
-                       }
-                       
-                       return $controls_with_check_list;
-               }
-               
                public function view_calendar_for_year()
                {
                        $location_code = phpgw::get_var('location_code');
@@ -191,7 +176,7 @@
 
                        $from_date_ts = strtotime("01/01/$year");
                        $to_year = $year + 1;
-                       $to_date_ts = strtotime("01/01/$to_year");      
+                       $to_date_ts = strtotime("01/01/$to_year");
                        
                        $criteria = array
                        (
@@ -211,43 +196,32 @@
                        $repeat_type = null;
                        
                        $controls_for_location_array = 
$this->so_control->get_controls_by_location($location_code, $from_date_ts, 
$to_date_ts, $repeat_type);
-                        
+                       
                        $this->calendar_builder = new 
calendar_builder($from_date_ts, $to_date_ts);
                
                        $controls_calendar_array = array();
-
-                       // Puts aggregate values for daily controls in a twelve 
month array
-                       foreach($controls_for_location_array as $control)
-                       {
-                               if($control->get_repeat_type() == 0 | 
$control->get_repeat_type() == 1)
-                               {
-                                       $controls_calendar_array = 
$this->calendar_builder->build_agg_calendar_array($controls_calendar_array, 
$control, $location_code, $year);
+               
+                       foreach($controls_for_location_array as &$control){
+                               if($control->get_repeat_type() == 0 | 
$control->get_repeat_type() == 1){
+                                       $control = 
$this->build_agg_open_cases_for_month_array($control, $location_code, $year);
                                }
                        }
+               
+                       $repeat_type = 2;
+                       // Fetches control ids with check lists for specified 
time period
+                       $control_id_with_check_list_array = 
$this->so->get_check_lists_for_location_2($location_code, $from_date_ts, 
$to_date_ts, $repeat_type);
                        
-                       $repeat_type = 2;
-                       $control_check_list_array_for_month = 
$this->so->get_check_lists_for_location( $location_code, $from_date_ts, 
$to_date_ts, $repeat_type );
-
+                       // Loops through all controls for location and 
populates controls with check lists
+                       $controls_for_location_array = 
$this->populate_controls_with_check_lists($controls_for_location_array, 
$control_id_with_check_list_array);
+                       
                        $repeat_type = 3;
-                       $control_check_list_array_for_year = 
$this->so->get_check_lists_for_location( $location_code, $from_date_ts, 
$to_date_ts, $repeat_type );
+                       // Fetches control ids with check lists for specified 
time period
+                       $control_id_with_check_list_array = 
$this->so->get_check_lists_for_location_2($location_code, $from_date_ts, 
$to_date_ts, $repeat_type);
                        
-                       $control_check_list_array = 
array_merge($control_check_list_array_for_month, 
$control_check_list_array_for_year);
-                       
-                       $in_array = 0;
-                       foreach($controls_for_location_array as $control_loc){
-                               foreach($control_check_list_array as 
$control_check_list){
-                                       if($control_loc->get_id() == 
$control_check_list->get_id()){
-                                               $in_array = 1;  
-                                       }
-                               }       
-
-                               if($in_array == 0 & 
$control_loc->get_repeat_type() != 0 & $control_loc->get_repeat_type() != 1 ){
-                                       $control_check_list_array[] = 
$control_loc;
-                               }
-                       }
-                                                                       
-                       $controls_calendar_array = 
$this->calendar_builder->build_calendar_array( $controls_calendar_array, 
$control_check_list_array, 12, "view_months" );
+                       // Loops through all controls for location and 
populates controls with check lists
+                       $controls_for_location_array = 
$this->populate_controls_with_check_lists($controls_for_location_array, 
$control_id_with_check_list_array);
        
+                       $controls_calendar_array = 
$this->calendar_builder->build_calendar_array( $controls_for_location_array, 
12, "view_months" );
                        
                        foreach($controls_calendar_array as &$inst)
                        {       
@@ -361,6 +335,60 @@
                        self::add_javascript('controller', 'controller', 
'jquery.js');
                        self::add_javascript('controller', 'controller', 
'ajax.js');
                }
+               
+               public function 
populate_controls_with_check_lists($controls_for_location_array, 
$control_id_with_check_list_array){
+                       $controls_with_check_list = array();
+                       
+                       foreach($controls_for_location_array as $control){
+                               foreach($control_id_with_check_list_array as 
$control_id){
+                                       if($control->get_id() == 
$control_id->get_id())
+                                               
$control->set_check_lists_array($control_id->get_check_lists_array());          
                                
+                               }
+                                       
+                               $controls_with_check_list[] = $control;
+                       }
+                       
+                       return $controls_with_check_list;
+               }
+               
+               function build_agg_open_cases_for_month_array($control, 
$location_code, $year){
+                       if( date("Y", $control->get_start_date()) == $year ){
+                               $from_month = date("n", 
$control->get_start_date());    
+                       }else{
+                               $from_month = 1;
+                       }
+                       
+                       if( date("Y", $control->get_end_date()) == $year ){
+                               $to_month = date("n", $control->get_end_date());
+                       }else{
+                               $to_month = 12;
+                       }
+                                       
+                       $agg_open_cases_for_month_array = array();
+                       
+                       for($from_month;$from_month<=$to_month;$from_month++){
+               
+                               $trail_from_date_ts = 
strtotime("$from_month/01/$year");
+                               
+                               $trail_to_date_ts = 
strtotime("$to_month/01/$year");
+                               $so_check_list = 
CreateObject('controller.socheck_list');
+                                       
+                               $num_open_cases_for_control_array = array();
+                               $num_open_cases_for_control_array = 
$so_check_list->get_num_open_cases_for_control( $control->get_id(), 
$location_code, $trail_from_date_ts, $trail_to_date_ts );       
+               
+                               if( !empty($num_open_cases_for_control_array) ){
+                                       $status_agg_month_info = new 
status_agg_month_info();
+                                       
$status_agg_month_info->set_month_nr(date("n", $from_month));
+                                       
$status_agg_month_info->set_agg_open_cases( 
$num_open_cases_for_control_array["count"] );
+                                       $agg_open_cases_for_month_array[] = 
$status_agg_month_info;
+                               } 
+                       }
+                       
+                       
$control->set_agg_open_cases_for_month_array($agg_open_cases_for_month_array);
+                       
+                       return $control;
+               }
+               
 
                public function query(){}
        }
\ No newline at end of file

Modified: 
branches/Version-1_0-branch/controller/inc/component/class.calendar_builder.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/component/class.calendar_builder.inc.php
 2012-02-16 09:30:54 UTC (rev 8888)
+++ 
branches/Version-1_0-branch/controller/inc/component/class.calendar_builder.inc.php
 2012-02-16 09:32:48 UTC (rev 8889)
@@ -1,8 +1,9 @@
 <?php
 phpgw::import_class('controller.socheck_list');
 include_class('controller', 'date_generator', 'inc/component/');
-
-       
+include_class('controller', 'check_list_status_info', 'inc/helper/');
+include_class('controller', 'check_list_status_manager', 'inc/helper/');
+               
 class calendar_builder {
        
        private $period_start_date;
@@ -13,130 +14,10 @@
         $this->period_end_date = $period_end_date;
        }
        
-       public function build_calendar_array( $controls_calendar_array, 
$control_array, $num, $period_type ){
+       function init_calendar( $control, $num, $period_type ){
                
-               foreach($control_array as $control){
-
-                       $calendar_array = $this->init_calendar( $control, 
$calendar_array, $num, $period_type );
-
-                       foreach($control->get_check_lists_array() as 
$check_list){
-                               
-                               $check_list_status_info = new 
check_list_status_info();
-                               $check_list_status_info->set_check_list_id( 
$check_list->get_id() );
+               $calendar_array = array();
                
-                               $todays_date_ts = mktime(0,0,0,date("m"), 
date("d"), date("Y"));
-
-                               if( $check_list->get_status() == 0 & 
$check_list->get_planned_date() > 0 & $check_list->get_deadline() > 
$todays_date_ts)
-                               {
-                                       $status = "control_planned";
-                               }
-                               else if( $check_list->get_status() == 0 & 
$check_list->get_planned_date() > 0 & $check_list->get_deadline() < 
$todays_date_ts )
-                               {
-                                       $status = 
"control_not_accomplished_with_info";
-                               }
-                               else if( $check_list->get_status() == 0 & 
$check_list->get_deadline() < $todays_date_ts )
-                               {
-                                       $status = "control_not_accomplished";
-                               }
-                               else if( $check_list->get_status() == 1 & 
$check_list->get_completed_date() > $check_list->get_deadline() & 
$check_list->get_num_open_cases() == 0)
-                               {
-                                       $status = 
"control_accomplished_over_time_without_errors";
-                               }
-                               else if( $check_list->get_status() == 1 & 
$check_list->get_completed_date() < $check_list->get_deadline() & 
$check_list->get_num_open_cases() == 0)
-                               {
-                                       $status = 
"control_accomplished_in_time_without_errors";
-                               }
-                               else if( $check_list->get_status() == 1 & 
$check_list->get_num_open_cases() > 0){
-                                       $status = 
"control_accomplished_with_errors";
-                                       
$check_list_status_info->set_num_open_cases($check_list->get_num_open_cases());
-                               }
-                               else if( $check_list->get_status() == 3 )
-                               {
-                                       $status = "control_canceled";
-                               }
-                               
-                               $check_list_status_info->set_deadline_date( 
date("d/m-Y", $check_list->get_deadline()) );
-                               
-                               if($period_type == "view_months")
-                               {
-                                       $calendar_array[ date("n", 
$check_list->get_deadline()) ]["status"] = $status;
-                                       $calendar_array[ date("n", 
$check_list->get_deadline()) ]["info"] = $check_list_status_info->serialize();  
     
-                               }
-                               else if( $period_type == "view_days" )
-                               {
-                                       $calendar_array[ date("j", 
$check_list->get_deadline()) ]["status"] = $status;
-                                       $calendar_array[ date("j", 
$check_list->get_deadline()) ]["info"] = $check_list_status_info->serialize();
-                               }
-                       }
-                       
-                       $controls_calendar_array[] = array("control" => 
$control->toArray(), "calendar_array" => $calendar_array);
-               }
-
-               return $controls_calendar_array;
-       }
-       
-       public function build_agg_calendar_array($controls_calendar_array, 
$control, $location_code, $year){
-                               
-               if( date("Y", $control->get_start_date()) == $year ){
-                       $from_month = date("n", $control->get_start_date());    
-               }else{
-                       $from_month = 1;
-               }
-               
-               if( date("Y", $control->get_end_date()) == $year ){
-                       $to_month = date("n", $control->get_end_date());
-               }else{
-                       $to_month = 12;
-               }
-               
-               /*
-               $todays_date_ts = mktime(0,0,0,date("m"), date("d"), date("Y"));
-               
-               $twelve_month_array = array();
-               
-               
-               for($i=1;$i<=12;$i++){
-                       $trail_date_ts = strtotime("$i/01/$year");
-
-                       if($trail_date_ts > $control->get_start_date() & 
$trail_date_ts < $todays_date_ts){
-                               $status = "controls_not_accomplished";
-                       }else if($trail_date_ts > $control->get_start_date() & 
$trail_date_ts > $todays_date_ts){
-                               $status = "controls_registered";
-                       }       
-
-                       $twelve_month_array[$i-1]["status"] = $status;
-               }
-               */
-               
-               for($from_month;$from_month<=$to_month;$from_month++){
-       
-                       $trail_from_date_ts = strtotime("$from_month/01/$year");
-                       
-                       $trail_to_date_ts = strtotime("$to_month/01/$year");
-                       $so_check_list = 
CreateObject('controller.socheck_list');
-                               
-                       $num_open_cases_for_control_array = array();
-                       $num_open_cases_for_control_array = 
$so_check_list->get_num_open_cases_for_control( $control->get_id(), 
$location_code, $trail_from_date_ts, $trail_to_date_ts );       
-       
-                       if( !empty($num_open_cases_for_control_array) ){
-                               $status = "controls_accomplished_with_errors";
-                               
-                               $twelve_month_array[$from_month-1]["status"] = 
$status;
-                               $twelve_month_array[$from_month-1]["info"] = 
$num_open_cases_for_control_array["count"];
-                       }else if( empty($num_open_cases_for_control_array) &  
$todays_date_ts > $trail_to_date_ts){
-                               $status = 
"controls_accomplished_without_errors";
-                               
-                               $twelve_month_array[$from_month-1]["status"] = 
$status;
-                       }
-               }
-       
-               $controls_calendar_array[] = array("control" => 
$control->toArray(), "calendar_array" => $twelve_month_array);
-                
-               return $controls_calendar_array;
-       }
-               
-       function init_calendar( $control, $calendar_array, $num, $period_type ){
-               
                for($i=1;$i<=$num;$i++){
                        $calendar_array[$i] = null;
                }
@@ -168,5 +49,44 @@
                }
                
                return $calendar_array;
-       } 
+       }
+       
+       public function build_calendar_array( $controls_with_check_lists_array, 
$num, $period_type ){
+               
+               foreach($controls_with_check_lists_array as $control){
+
+                       $calendar_array = $this->init_calendar( $control, $num, 
$period_type );
+
+                       if($period_type == "view_days" | ($period_type == 
"view_months" & $control->get_repeat_type() == 2 | $control->get_repeat_type() 
== 3))
+                       {
+                               foreach($control->get_check_lists_array() as 
$check_list)
+                               {
+                                       $check_list_status_manager = new 
check_list_status_manager( $check_list );
+                                       
+                                       $check_list_status_info = 
$check_list_status_manager->get_status_for_check_list(); 
+                                                               
+                                       $calendar_array[ date("j", 
$check_list->get_deadline()) ]["status"] = 
$check_list_status_info->get_status();
+                                       $calendar_array[ date("j", 
$check_list->get_deadline()) ]["info"] = $check_list_status_info->serialize();
+                               }
+                               
+                               $controls_calendar_array[] = array("control" => 
$control->toArray(), "calendar_array" => $calendar_array);
+                       }
+                       else if($period_type == "view_months" & 
($control->get_repeat_type() == 0 | $control->get_repeat_type() == 1))
+                       {
+                               $twelve_month_array = array();
+                               
+                               
foreach($control->get_agg_open_cases_for_month_array() as 
$status_agg_month_info)
+                               {
+                                       $status = 
"controls_accomplished_with_errors";
+                                               
+                                       
$twelve_month_array[$status_agg_month_info->get_month_nr()]["status"] = $status;
+                                       
$twelve_month_array[$status_agg_month_info->get_month_nr()]["info"] = 
$status_agg_month_info->get_agg_open_cases();
+                               }
+                                       
+                               $controls_calendar_array[] = array("control" => 
$control->toArray(), "calendar_array" => $twelve_month_array);
+                       }
+               }
+
+               return $controls_calendar_array;
+       }
 }
\ No newline at end of file

Modified: 
branches/Version-1_0-branch/controller/inc/component/class.date_generator.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/component/class.date_generator.inc.php
   2012-02-16 09:30:54 UTC (rev 8888)
+++ 
branches/Version-1_0-branch/controller/inc/component/class.date_generator.inc.php
   2012-02-16 09:32:48 UTC (rev 8889)
@@ -32,7 +32,7 @@
                }
                
                $period_start_date = $this->find_start_date_for_period( 
$control_start_date );
-       
+         
                $interval_date = $period_start_date;
                
                while(($interval_date < $this->period_end_date) && 
($interval_date <= $control_end_date)){

Modified: 
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_info.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_info.inc.php
      2012-02-16 09:30:54 UTC (rev 8888)
+++ 
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_info.inc.php
      2012-02-16 09:32:48 UTC (rev 8889)
@@ -36,7 +36,7 @@
                private $deadline_date;
                private $info_text;
                private $num_open_cases;
-       
+                       
                public function __construct(){}
                
                public function set_check_list_id($check_list_id)

Copied: 
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_manager.inc.php
 (from rev 8888, 
trunk/controller/inc/helper/class.check_list_status_manager.inc.php)
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_manager.inc.php
                           (rev 0)
+++ 
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_manager.inc.php
   2012-02-16 09:32:48 UTC (rev 8889)
@@ -0,0 +1,83 @@
+<?php
+       /**
+       * phpGroupWare - controller: a part of a Facilities Management System.
+       *
+       * @author Erink Holm-Larsen <address@hidden>
+       * @author Torstein Vadla <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare 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; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage controller
+       * @version $Id: class.check_list_status_info.inc.php 8885 2012-02-16 
07:41:15Z vator $
+       */
+
+       include_class('controller', 'check_list_status_info', 'inc/helper/');
+
+       class check_list_status_manager
+       {               
+               private $check_list;
+               
+               public function __construct($check_list){
+                       $this->check_list = $check_list;
+               }
+               
+               function get_status_for_check_list(){
+               
+                       $check_list_status_info = new check_list_status_info();
+                       $check_list_status_info->set_check_list_id( 
$this->check_list->get_id() );
+       
+                       $todays_date_ts = mktime(0,0,0,date("m"), date("d"), 
date("Y"));
+       
+                       if( $this->check_list->get_status() == 0 & 
$this->check_list->get_planned_date() > 0 & $this->check_list->get_deadline() > 
$todays_date_ts)
+                       {
+                               $status = "control_planned";
+                       }
+                       else if( $this->check_list->get_status() == 0 & 
$this->check_list->get_planned_date() > 0 & $this->check_list->get_deadline() < 
$todays_date_ts )
+                       {
+                               $status = "control_not_accomplished_with_info";
+                       }
+                       else if( $this->check_list->get_status() == 0 & 
$this->check_list->get_deadline() < $todays_date_ts )
+                       {
+                               $status = "control_not_accomplished";
+                       }
+                       else if( $this->check_list->get_status() == 1 & 
$this->check_list->get_completed_date() > $this->check_list->get_deadline() & 
$this->check_list->get_num_open_cases() == 0)
+                       {
+                               $status = 
"control_accomplished_over_time_without_errors";
+                       }
+                       else if( $this->check_list->get_status() == 1 & 
$this->check_list->get_completed_date() < $this->check_list->get_deadline() & 
$this->check_list->get_num_open_cases() == 0)
+                       {
+                               $status = 
"control_accomplished_in_time_without_errors";
+                       }
+                       else if( $this->check_list->get_status() == 1 & 
$this->check_list->get_num_open_cases() > 0){
+                               $status = "control_accomplished_with_errors";
+                               
$check_list_status_info->set_num_open_cases($this->check_list->get_num_open_cases());
+                       }
+                       else if( $this->check_list->get_status() == 3 )
+                       {
+                               $status = "control_canceled";
+                       }
+                       
+                       
+                       $check_list_status_info->set_deadline_date( 
date("d/m-Y", $this->check_list->get_deadline()) );
+                       $check_list_status_info->set_status($status);
+               
+                       return $check_list_status_info; 
+               }
+       }

Copied: 
branches/Version-1_0-branch/controller/inc/helper/class.status_agg_month_info.inc.php
 (from rev 8888, 
trunk/controller/inc/helper/class.status_agg_month_info.inc.php)
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/helper/class.status_agg_month_info.inc.php
                               (rev 0)
+++ 
branches/Version-1_0-branch/controller/inc/helper/class.status_agg_month_info.inc.php
       2012-02-16 09:32:48 UTC (rev 8889)
@@ -0,0 +1,59 @@
+<?php
+       /**
+       * phpGroupWare - controller: a part of a Facilities Management System.
+       *
+       * @author Erink Holm-Larsen <address@hidden>
+       * @author Torstein Vadla <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare 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; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage controller
+       * @version $Id: class.check_list_status_info.inc.php 8571 2012-01-15 
13:46:27Z vator $
+       */
+
+       class status_agg_month_info
+       {               
+               private $month_nr;
+               private $agg_open_cases;
+                       
+               public function __construct(){}
+               
+               public function set_month_nr($month_nr)
+               {
+                       $this->month_nr = $month_nr;
+               }
+               
+               public function get_month_nr() { return $this->month_nr; }
+               
+               public function set_agg_open_cases($agg_open_cases)
+               {
+                       $this->agg_open_cases = $agg_open_cases;
+               }
+               
+               public function get_agg_open_cases() { return 
$this->agg_open_cases; }
+                               
+               public function serialize()
+               {
+                       return array(
+                               'agg_open_cases' => $this->get_agg_open_cases(),
+                               'month_nr' => $this->get_month_nr()
+                       );
+               }
+       }

Modified: branches/Version-1_0-branch/controller/inc/model/class.control.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/model/class.control.inc.php      
2012-02-16 09:30:54 UTC (rev 8888)
+++ branches/Version-1_0-branch/controller/inc/model/class.control.inc.php      
2012-02-16 09:32:48 UTC (rev 8889)
@@ -58,7 +58,7 @@
                // Objects
                protected $check_lists_array = array();
                // Array that contains open cases for a month   
-               protected $agg_check_lists_array = array();
+               protected $agg_open_cases_for_month_array = array();
                
                /**
                 * Constructor.  Takes an optional ID.  If a contract is 
created from outside
@@ -211,6 +211,13 @@
                
                public function get_check_lists_array() { return 
$this->check_lists_array; }
                
+               public function 
set_agg_open_cases_for_month_array($agg_open_cases_for_month_array)
+               {
+                       $this->agg_open_cases_for_month_array = 
$agg_open_cases_for_month_array;
+               }
+               
+               public function get_agg_open_cases_for_month_array() { return 
$this->agg_open_cases_for_month_array; }
+               
                /**
                 * Get a static reference to the storage object associated with 
this model object
                 * 

Modified: branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php    
2012-02-16 09:30:54 UTC (rev 8888)
+++ branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php    
2012-02-16 09:32:48 UTC (rev 8889)
@@ -79,7 +79,7 @@
                        }
                        else
                        {
-                               $user_lid = 'all';
+                               $user_lid = isset($_REQUEST['user_lid']) ? 
$user_lid : 'all';
                        }
 
                        if($voucher_id)
@@ -127,7 +127,7 @@
                        $this->district_id              = 
isset($data['district_id'])?$data['district_id']:'';
                }
 
-               function 
read_invoice($paid='',$start_date='',$end_date='',$vendor_id='',$loc1='',$workorder_id='',$voucher_id=0)
+               function 
read_invoice($paid='',$start_date='',$end_date='',$vendor_id='',$loc1='',$workorder_id='',$voucher_id=0,
 $invoice_id = '')
                {
                        if(!phpgw::get_var('paid', 'bool'))
                        {
@@ -142,7 +142,7 @@
                                
'start_date'=>$start_date,'end_date'=>$end_date,'vendor_id'=>$vendor_id,
                                
'loc1'=>$loc1,'workorder_id'=>$workorder_id,'allrows'=>$this->allrows,
                                'voucher_id'=>$voucher_id,'b_account_class' 
=>$this->b_account_class,
-                               'district_id' => $this->district_id));
+                               'district_id' => $this->district_id, 
'invoice_id' => $invoice_id));
 
                        $soXport    = CreateObject('property.soXport');
                        $soworkorder = CreateObject('property.soworkorder');

Modified: branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php    
2012-02-16 09:30:54 UTC (rev 8888)
+++ branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php    
2012-02-16 09:32:48 UTC (rev 8889)
@@ -81,6 +81,7 @@
                        $voucher_id     = 
isset($data['voucher_id'])?$data['voucher_id']:'';
                        $b_account_class= 
isset($data['b_account_class'])?$data['b_account_class']:'';
                        $district_id    = 
isset($data['district_id'])?$data['district_id']:'';
+                       $invoice_id             = $data['invoice_id'] ? 
$data['invoice_id'] :'';
 
                        $join_tables    = '';
                        $filtermethod   = '';
@@ -131,15 +132,21 @@
 
                        if ($vendor_id)
                        {
-                               $filtermethod .= " $where  spvend_code 
='$vendor_id' ";
+                               $filtermethod .= " $where  spvend_code 
='{$vendor_id}' ";
                                $where= 'AND';
                        }
                        if ($loc1)
                        {
-                               $filtermethod .= " $where  dima $this->like 
'%$loc1%' ";
+                               $filtermethod .= " $where  dima {$this->like} 
'%$loc1%' ";
                                $where= 'AND';
                        }
 
+                       if ($invoice_id)
+                       {
+                               $filtermethod .= " $where fakturanr 
='{$invoice_id}'";
+                               $where= 'AND';
+                       }
+
                        if ($paid)
                        {
                                $table = 'fm_ecobilagoverf';
@@ -151,7 +158,7 @@
                                        $join_tables .= " $this->join 
fm_b_account ON fm_ecobilagoverf.spbudact_code = fm_b_account.id";
                                }
 
-                               if (!$workorder_id && !$voucher_id)
+                               if (!$workorder_id && !$voucher_id && 
!$invoice_id)
                                {
                                        $start_periode = date('Ym',$start_date);
                                        $end_periode = date('Ym',$end_date);

Modified: branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php    
2012-02-16 09:30:54 UTC (rev 8888)
+++ branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php    
2012-02-16 09:32:48 UTC (rev 8889)
@@ -209,6 +209,7 @@
                        $workorder_id   = phpgw::get_var('workorder_id', 'int');
                        $loc1                   = phpgw::get_var('loc1');
                        $voucher_id     = $this->query && 
ctype_digit($this->query) ? $this->query : phpgw::get_var('voucher_id', 'int');
+                       $invoice_id             = phpgw::get_var('invoice_id');
                        $b_account_class= phpgw::get_var('b_account_class', 
'int');
 
                        $this->save_sessiondata();
@@ -510,6 +511,25 @@
                                                                'style' => 
'filter'
                                                        ),
                                                        array
+                                                       ( // Voucher link
+                                                               'type' => 
'link',
+                                                               'id' => 
'lnk_invoice',
+                                                               'url' => "",
+                                                               'value' => 
lang('invoice number'),
+                                                               'tab_index' => 
9,
+                                                               'style' => 
'filter'
+                                                       ),
+                                                       array
+                                                       ( // Vendor box
+                                                               'name'     => 
'invoice_id',
+                                                               'id'     => 
'txt_invoice',
+                                                               'value'    => 
$invoice_id,
+                                                               'type' => 
'text',
+                                                               'size'    => 10,
+                                                               'tab_index' => 
10,
+                                                               'style' => 
'filter'
+                                                       ),
+                                                       array
                                                        (
                                                                'type' => 
'link',
                                                                'id' => 
'lnk_property',
@@ -522,7 +542,7 @@
                                                                        
'lookup_name'   => 0,
                                                                
))."','Search','left=50,top=100,width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes')",
                                                                'value' => 
lang('property'),
-                                                               'tab_index' => 
9,
+                                                               'tab_index' => 
11,
                                                                'style' => 
'filter'
                                                        ),
                                                        array
@@ -541,7 +561,7 @@
                                                                'value'    => 
$loc1,
                                                                'type' => 
'text',
                                                                'size'    => 8,
-                                                               'tab_index' => 
10,
+                                                               'tab_index' => 
12,
                                                                'style' => 
'filter'
                                                        ),
                                                        array
@@ -550,7 +570,7 @@
                                                                'id' => 
'lnk_voucher',
                                                                'url' => "",
                                                                'value' => 
lang('Voucher ID'),
-                                                               'tab_index' => 
11,
+                                                               'tab_index' => 
13,
                                                                'style' => 
'filter'
                                                        ),
                                                        array
@@ -560,7 +580,7 @@
                                                                'value'    => 
$voucher_id,
                                                                'type' => 
'text',
                                                                'size'    => 8,
-                                                               'tab_index' => 
12,
+                                                               'tab_index' => 
14,
                                                                'style' => 
'filter'
                                                        ),
                                                        array
@@ -569,14 +589,14 @@
                                                                'name' => 
'search',
                                                                'value'    => 
lang('search'),
                                                                'type' => 
'button',
-                                                               'tab_index' => 
13,
+                                                               'tab_index' => 
15,
                                                                'style' => 
'filter'
                                                        ),
                                                        array
                                                        ( // boton exportar
                                                                'type'  => 
'button',
                                                                'id'    => 
'btn_export',
-                                                               'tab_index' => 
13,
+                                                               'tab_index' => 
16,
                                                                'value' => 
lang('download')
                                                        ),
                                                        array
@@ -585,7 +605,7 @@
                                                                'name' => 
'cat_id',
                                                                'value' => 
lang('Category'),
                                                                'type' => 
'button',
-                                                               'tab_index' => 
14,
+                                                               'tab_index' => 
17,
                                                                'style' => 
'filter'
                                                        ),
                                                        array
@@ -594,7 +614,7 @@
                                                                'name' => 
'user_lid',
                                                                'value' => 
user_lid,
                                                                'type' => 
'button',
-                                                               'tab_index' => 
15,
+                                                               'tab_index' => 
18,
                                                                'style' => 
'filter'
                                                        ),
                                                        array
@@ -603,7 +623,7 @@
                                                                'name' => 
'b_account_class',
                                                                'value' => 
lang('No account'),
                                                                'type' => 
'button',
-                                                               'tab_index' => 
16,
+                                                               'tab_index' => 
19,
                                                                'style' => 
'filter'
                                                        ),
                                                        array
@@ -712,7 +732,7 @@
 
                        $content = array();
                        //the first time, $content is empty, because 
$user_lid=''.In the seconfd time, user_lid=all; It is done using  base_java_url.
-                       $content = 
$this->bo->read_invoice($paid,$start_date,$end_date,$vendor_id,$loc1,$workorder_id,$voucher_id);
+                       $content = 
$this->bo->read_invoice($paid,$start_date,$end_date,$vendor_id,$loc1,$workorder_id,$voucher_id,$invoice_id);
 
 
                        $uicols = array (

Modified: 
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
===================================================================
--- 
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
   2012-02-16 09:30:54 UTC (rev 8888)
+++ 
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
   2012-02-16 09:32:48 UTC (rev 8889)
@@ -206,6 +206,64 @@
                        }
                }
 
+               protected function remind()
+               {
+                       if 
(!isset($GLOBALS['phpgw_info']['server']['smtp_server']) || 
!$GLOBALS['phpgw_info']['server']['smtp_server'])
+                       {
+                               return;
+                       }
+
+                       // max. one mail each day
+                       if ( (int) 
$GLOBALS['phpgw_info']['server']['invoice_mail_reminder_time'] < (time() - (5 * 
3600 * 24)) )
+                       {
+                               $toarray = array();
+                               $_toarray = array();
+                               $sql = 'SELECT DISTINCT oppsynsmannid as 
responsible FROM fm_ecobilag WHERE oppsynsmannid IS NOT NULL';
+                               $this->db->query($sql,__LINE__,__FILE__);
+                               while($this->db->next_record())
+                               {
+                                       $toarray[$this->db->f('responsible')] = 
true;
+                               }
+                               $sql = 'SELECT DISTINCT saksbehandlerid as 
responsible FROM fm_ecobilag WHERE saksbehandlerid IS NOT NULL';
+                               $this->db->query($sql,__LINE__,__FILE__);
+                               while($this->db->next_record())
+                               {
+                                       $toarray[$this->db->f('responsible')] = 
true;
+                               }
+                               $sql = 'SELECT DISTINCT budsjettansvarligid as 
responsible FROM fm_ecobilag WHERE budsjettansvarligid IS NOT NULL';
+                               $this->db->query($sql,__LINE__,__FILE__);
+
+                               while($this->db->next_record())
+                               {
+                                       $toarray[$this->db->f('responsible')] = 
true;
+                               }
+
+                               $subject = 'Du har faktura til behandling';
+
+                               foreach ($toarray as $lid => &$email)
+                               {
+                                       $prefs = 
$this->bocommon->create_preferences('property', 
$GLOBALS['phpgw']->accounts->name2id($lid));
+                                       if(isset($prefs['email']) && 
$prefs['email'])
+                                       {
+                                               $body = '<a href ="' . 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiinvoice.index', 'voucher_id' => $bilagsnr, 'user_lid' => $lid 
),false,true).'">Link til fakturabehandling</a>';
+                                               try
+                                               {
+                                                       $rc = 
$this->send->msg('email',$prefs['email'], $subject, stripslashes($body), '', 
'', '','','','html');
+                                               }
+                                               catch (phpmailerException $e)
+                                               {
+                                                       
$this->receipt['error'][] = array('msg' => $e->getMessage());
+                                               }
+                                       }
+                               }
+                               // save time of mail, to not send to many mails
+                               $config = createObject('phpgwapi.config', 
'phpgwapi');
+                               $config->read_repository();
+                               $config->value('invoice_mail_reminder_time', 
time());
+                               $config->save_repository();
+                       }
+               }
+
                public function execute($cron='')
                {
                        
if(isset($this->config->config_data['import']['check_archive']) && 
$this->config->config_data['import']['check_archive'])
@@ -281,6 +339,8 @@
                                $this->receipt['error'][] = array('msg' => 
"Arkiv katalog '{$dirname}/archive/' ikke er ikke skrivbar - kontakt 
systemadminstrator for å korrigere");
                        }
 
+                       $this->remind();
+
                        if(!$cron)
                        {
                                $this->confirm($execute=false);

Modified: branches/Version-1_0-branch/property/js/yahoo/invoice.paid.index.js
===================================================================
--- branches/Version-1_0-branch/property/js/yahoo/invoice.paid.index.js 
2012-02-16 09:30:54 UTC (rev 8888)
+++ branches/Version-1_0-branch/property/js/yahoo/invoice.paid.index.js 
2012-02-16 09:32:48 UTC (rev 8889)
@@ -22,16 +22,17 @@
                 [
                  {name:'lnk_workorder', title:'Workorder ID', 
description:'enter the Workorder ID to search by workorder - at any Date'},
                  {name:'lnk_vendor', title:'Vendor', description:'Select the 
vendor by clicking this link'},
+                 {name:'lnk_invoice', title:'Invoice', description:'Enter the 
invoice id - any Date'},
                  {name:'lnk_property', title:'Facilities Managements', 
description:'Select the property by clicking this link'},
                  {name:'lnk_voucher', title:'Voucher', description:'enter the 
voucher ID to search by vouvher - at any Date'}
                 ]
 
-
                var textImput = [
                        {order:0, name:'workorder_id',  id:'txt_workorder'},
                        {order:1, name:'vendor_id',             
id:'txt_vendor'},
-                       {order:1, name:'loc1',                  id:'txt_loc1'},
-                       {order:3, name:'voucher_id',    id:'txt_voucher'}
+                       {order:2, name:'invoice_id',    id:'txt_invoice'},
+                       {order:3, name:'loc1',                  id:'txt_loc1'},
+                       {order:4, name:'voucher_id',    id:'txt_voucher'}
                ]
 
                var toolTips = [
@@ -131,9 +132,3 @@
 
                    loader.insert();
                });
-
-
-
-
-
-




reply via email to

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