fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16421] Stable: Merge 16418:16420 from trunk


From: sigurdne
Subject: [Fmsystem-commits] [16421] Stable: Merge 16418:16420 from trunk
Date: Thu, 9 Mar 2017 13:18:19 -0500 (EST)

Revision: 16421
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16421
Author:   sigurdne
Date:     2017-03-09 13:18:18 -0500 (Thu, 09 Mar 2017)
Log Message:
-----------
Stable: Merge 16418:16420 from trunk

Modified Paths:
--------------
    branches/Version-2_0-branch/eventplanner/inc/class.boapplication.inc.php
    branches/Version-2_0-branch/eventplanner/inc/class.soapplication.inc.php
    branches/Version-2_0-branch/eventplanner/inc/class.socustomer.inc.php
    branches/Version-2_0-branch/eventplanner/inc/class.uibooking.inc.php
    branches/Version-2_0-branch/eventplanner/inc/model/class.booking.inc.php
    branches/Version-2_0-branch/phpgwapi/inc/class.socommon.inc.php
    branches/Version-2_0-branch/rental/inc/class.uibilling.inc.php
    branches/Version-2_0-branch/rental/inc/class.uiinvoice_price_item.inc.php
    branches/Version-2_0-branch/rental/inc/class.uiparty.inc.php
    branches/Version-2_0-branch/rental/inc/model/class.invoice.inc.php

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

Index: branches/Version-2_0-branch
===================================================================
--- branches/Version-2_0-branch 2017-03-09 18:16:05 UTC (rev 16420)
+++ branches/Version-2_0-branch 2017-03-09 18:18:18 UTC (rev 16421)

Property changes on: branches/Version-2_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
## -1,4 +1,4 ##
 /branches/dev-syncromind:13653
 /branches/dev-syncromind-2:14933-16394
 /branches/stavangerkommune:12743-12875,12986
-/trunk:14721-14732,14734-14735,14737,14739,14741,14743-14744,14746-14749,14751,14753,14755-14757,14759,14761-14764,14766-14768,14770-14783,14785-14792,14794-14813,14815-14816,14818,14820-14822,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14847,14849-14866,14868-14869,14871,14873-14875,14877-14878,14880-14884,14886-14896,14898,14900-14902,14904,14906-14909,14911-14915,14917-14919,14921-14922,14924-14978,14980-15258,15260-15261,15263-15264,15266-15285,15287-15288,15290-15291,15293,15295,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15356,15358,15360-15541,15543-15566,15568-15569,15571,15573-15581,15583,15585-15617,15619,15621-15630,15632-15635,15637-15639,15641-15643,15645,15647-15665,15667-15668,15670-15671,15673-15693,15695-15712,15714-15764,15766-15767,15769-15787,15789-15802,15804-15811,15813-15814,15816-15818,15820-15849,15851-15887,15889-15900,15902-16046,16048-16051,16053,16055,16057-16063,16065-16071,16073-16077,16079-16081,16083-16099,16101-16130,16132-16140,16142,16144-16212,16214-16219,16221,16223-16224,16226,16228-16229,16231,16233,16235,16237,16239-16240,16242,16244-16246,16248,16250-16251,16253-16255,16257-16259,16261,16263,16265,16267,16269-16276,16278,16280-16283,16285,16287-16288,16290,16292-16295,16297-16305,16307-16314,16316-16318,16320-16322,16324,16326-16330,16332,16334,16336,16338-16339,16341-16342,16344,16346,16348,16350,16352-16353,16355-16358,16360,16362,16364-16369,16371,16373,16375-16378,16380,16382-16383,16385,16387,16389,16391,16393-16395,16397,16399-16402,16404,16406,16408,16410-16415,16417
\ No newline at end of property
+/trunk:14721-14732,14734-14735,14737,14739,14741,14743-14744,14746-14749,14751,14753,14755-14757,14759,14761-14764,14766-14768,14770-14783,14785-14792,14794-14813,14815-14816,14818,14820-14822,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14847,14849-14866,14868-14869,14871,14873-14875,14877-14878,14880-14884,14886-14896,14898,14900-14902,14904,14906-14909,14911-14915,14917-14919,14921-14922,14924-14978,14980-15258,15260-15261,15263-15264,15266-15285,15287-15288,15290-15291,15293,15295,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15356,15358,15360-15541,15543-15566,15568-15569,15571,15573-15581,15583,15585-15617,15619,15621-15630,15632-15635,15637-15639,15641-15643,15645,15647-15665,15667-15668,15670-15671,15673-15693,15695-15712,15714-15764,15766-15767,15769-15787,15789-15802,15804-15811,15813-15814,15816-15818,15820-15849,15851-15887,15889-15900,15902-16046,16048-16051,16053,16055,16057-16063,16065-16071,16073-16077,16079-16081,16083-16099,16101-16130,16132-16140,16142,16144-16212,16214-16219,16221,16223-16224,16226,16228-16229,16231,16233,16235,16237,16239-16240,16242,16244-16246,16248,16250-16251,16253-16255,16257-16259,16261,16263,16265,16267,16269-16276,16278,16280-16283,16285,16287-16288,16290,16292-16295,16297-16305,16307-16314,16316-16318,16320-16322,16324,16326-16330,16332,16334,16336,16338-16339,16341-16342,16344,16346,16348,16350,16352-16353,16355-16358,16360,16362,16364-16369,16371,16373,16375-16378,16380,16382-16383,16385,16387,16389,16391,16393-16395,16397,16399-16402,16404,16406,16408,16410-16415,16417,16419-16420
\ No newline at end of property
Modified: 
branches/Version-2_0-branch/eventplanner/inc/class.boapplication.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/class.boapplication.inc.php    
2017-03-09 18:16:05 UTC (rev 16420)
+++ branches/Version-2_0-branch/eventplanner/inc/class.boapplication.inc.php    
2017-03-09 18:18:18 UTC (rev 16421)
@@ -99,11 +99,11 @@
                        return $values;
                }
 
-               public function read_single($id, $return_object = true)
+               public function read_single($id, $return_object = true, 
$relaxe_acl = false)
                {
                        if ($id)
                        {
-                               $values = 
eventplanner_soapplication::get_instance()->read_single($id, $return_object);
+                               $values = 
eventplanner_soapplication::get_instance()->read_single($id, $return_object, 
$relaxe_acl);
                        }
                        else
                        {

Modified: 
branches/Version-2_0-branch/eventplanner/inc/class.soapplication.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/class.soapplication.inc.php    
2017-03-09 18:16:05 UTC (rev 16420)
+++ branches/Version-2_0-branch/eventplanner/inc/class.soapplication.inc.php    
2017-03-09 18:18:18 UTC (rev 16421)
@@ -73,7 +73,7 @@
                {
                        $clause = '';
 
-                       if($this->use_acl && $this->currentapp && 
$this->acl_location)
+                       if(!$this->relaxe_acl && ($this->use_acl && 
$this->currentapp && $this->acl_location))
                        {
                                $paranthesis = false;
 

Modified: branches/Version-2_0-branch/eventplanner/inc/class.socustomer.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/class.socustomer.inc.php       
2017-03-09 18:16:05 UTC (rev 16420)
+++ branches/Version-2_0-branch/eventplanner/inc/class.socustomer.inc.php       
2017-03-09 18:18:18 UTC (rev 16421)
@@ -55,7 +55,25 @@
                        return self::$so;
                }
 
+               function get_acl_condition( )
+               {
+                       $acl_condition = parent::get_acl_condition();
+                       
+                       $sql = "SELECT object_id, permission FROM 
eventplanner_permission WHERE subject_id = {$this->account}";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $object_ids = array(-1);
+                       while ($this->db->next_record())
+                       {
+                               $permission = $this->db->f('permission');
+                               if($permission & PHPGW_ACL_READ)
+                               {
+                                       $object_ids[] = 
$this->db->f('object_id');
+                               }
+                       }
 
+                       return '(' . $acl_condition . ' OR 
eventplanner_customer.id IN (' . implode(',', $object_ids) . '))';
+               }
+
                protected function populate( array $data )
                {
                        $object = new eventplanner_customer();

Modified: branches/Version-2_0-branch/eventplanner/inc/class.uibooking.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/class.uibooking.inc.php        
2017-03-09 18:16:05 UTC (rev 16420)
+++ branches/Version-2_0-branch/eventplanner/inc/class.uibooking.inc.php        
2017-03-09 18:18:18 UTC (rev 16421)
@@ -279,7 +279,7 @@
                                )
                        );
 
-                       $application = 
createObject('eventplanner.boapplication')->read_single($booking->application_id);
+                       $application = 
createObject('eventplanner.boapplication')->read_single($booking->application_id,
 true, $relaxe_acl = true);
 
 //                     $GLOBALS['phpgw']->jqcal2->add_listener('from_', 
'datetime', $booking->from_, array(
 //                                     'min_date' => date('Y/m/d', 
$application->date_start),

Modified: 
branches/Version-2_0-branch/eventplanner/inc/model/class.booking.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/model/class.booking.inc.php    
2017-03-09 18:16:05 UTC (rev 16420)
+++ branches/Version-2_0-branch/eventplanner/inc/model/class.booking.inc.php    
2017-03-09 18:18:18 UTC (rev 16421)
@@ -264,7 +264,7 @@
 
                        if (!empty($entity->application_id))
                        {
-                               $application = 
createObject('eventplanner.boapplication')->read_single($entity->application_id);
+                               $application = 
createObject('eventplanner.boapplication')->read_single($entity->application_id,
 true, $relaxe_acl = true);
                                $entity->to_ = $entity->from_ + 
((int)$application->timespan * 60);
                        }
 

Modified: branches/Version-2_0-branch/phpgwapi/inc/class.socommon.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.socommon.inc.php     
2017-03-09 18:16:05 UTC (rev 16420)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.socommon.inc.php     
2017-03-09 18:18:18 UTC (rev 16421)
@@ -44,6 +44,7 @@
                protected $currentapp;
                protected $acl;
                protected $relaxe_acl;
+               protected $account;
 
                public function __construct( $table_name, $fields )
                {
@@ -59,6 +60,7 @@
                        $this->dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
                        $this->currentapp = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->acl = & $GLOBALS['phpgw']->acl;
+                       $this->account = 
(int)$GLOBALS['phpgw_info']['user']['account_id'];
                }
 
                /**
@@ -364,12 +366,18 @@
                        return $conditions;
                }
 
-               function read_single( $id, $return_object = false )
+               function read_single( $id, $return_object = false , $relaxe_acl 
= false)
                {
                        if (!$id && !$return_object)
                        {
                                return array();
                        }
+
+                       if($relaxe_acl)
+                       {
+                               $this->relaxe_acl = $relaxe_acl;
+                       }
+
                        $row = array();
                        $pk_params = $this->primary_key_conditions($id);
 

Modified: branches/Version-2_0-branch/rental/inc/class.uibilling.inc.php
===================================================================
--- branches/Version-2_0-branch/rental/inc/class.uibilling.inc.php      
2017-03-09 18:16:05 UTC (rev 16420)
+++ branches/Version-2_0-branch/rental/inc/class.uibilling.inc.php      
2017-03-09 18:18:18 UTC (rev 16421)
@@ -129,7 +129,7 @@
                                                        (array) 
$contract_ids_override,
                                                        
phpgw::get_var('export_format'),
                                                        $existing_billing,
-                                                       
$contract_bill_only_one_time,
+                                                       (array) 
$contract_bill_only_one_time,
                                                        $_dry_run = true
                                                );
                                                $simulation_data = array();
@@ -403,7 +403,21 @@
 
                                        if ($missing_billing_info == null || 
count($missing_billing_info) == 0)
                                        {
-                                               $billing_job = 
rental_sobilling::get_instance()->create_billing(isset($GLOBALS['phpgw_info']['user']['preferences']['rental']['currency_decimal_places'])
 ? 
isset($GLOBALS['phpgw_info']['user']['preferences']['rental']['currency_decimal_places'])
 : 2, phpgw::get_var('contract_type'), phpgw::get_var('billing_term'), 
phpgw::get_var('year'), phpgw::get_var('month'), phpgw::get_var('title'), 
$GLOBALS['phpgw_info']['user']['account_id'], $contract_ids, 
$contract_ids_override, phpgw::get_var('export_format'), $existing_billing, 
$contract_bill_only_one_time);
+                                               $billing_job = 
rental_sobilling::get_instance()->create_billing(
+                                                       
isset($GLOBALS['phpgw_info']['user']['preferences']['rental']['currency_decimal_places'])
 ? 
isset($GLOBALS['phpgw_info']['user']['preferences']['rental']['currency_decimal_places'])
 : 2,
+                                                       
phpgw::get_var('contract_type'),
+                                                       
phpgw::get_var('billing_term'),
+                                                       phpgw::get_var('year'),
+                                                       phpgw::get_var('month'),
+                                                       phpgw::get_var('title'),
+                                                       
$GLOBALS['phpgw_info']['user']['account_id'],
+                                                       $contract_ids,
+                                                       $contract_ids_override,
+                                                       
phpgw::get_var('export_format'),
+                                                       $existing_billing,
+                                                       
$contract_bill_only_one_time,
+                                                       $_dry_run = false
+                                               );
                                                
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'rental.uibilling.view',
                                                        'id' => 
$billing_job->get_id()));
                                                return;
@@ -1483,7 +1497,7 @@
                        $sort_field = ($columns[$order[0]['column']]['data']) ? 
$columns[$order[0]['column']]['data'] : 'id';
                        $sort_ascending = ($order[0]['dir'] == 'desc') ? false 
: true;
                        // Form variables
-                       $search_for = $search['value'];
+                       $search_for = (string)$search['value'];
                        $search_type = phpgw::get_var('search_option', 
'string', 'REQUEST', 'all');
 
                        // Create an empty result set
@@ -1495,7 +1509,7 @@
                        $export = phpgw::get_var('export', 'bool');
                        if ($export)
                        {
-                               $num_of_objects = null;
+                               $num_of_objects = 0;
                        }
 
                        switch ($query_type)

Modified: 
branches/Version-2_0-branch/rental/inc/class.uiinvoice_price_item.inc.php
===================================================================
--- branches/Version-2_0-branch/rental/inc/class.uiinvoice_price_item.inc.php   
2017-03-09 18:16:05 UTC (rev 16420)
+++ branches/Version-2_0-branch/rental/inc/class.uiinvoice_price_item.inc.php   
2017-03-09 18:18:18 UTC (rev 16421)
@@ -40,7 +40,7 @@
 
                        if ($export)
                        {
-                               $num_of_objects = null;
+                               $num_of_objects = 0;
                        }
 
                        // Create an empty result set

Modified: branches/Version-2_0-branch/rental/inc/class.uiparty.inc.php
===================================================================
--- branches/Version-2_0-branch/rental/inc/class.uiparty.inc.php        
2017-03-09 18:16:05 UTC (rev 16420)
+++ branches/Version-2_0-branch/rental/inc/class.uiparty.inc.php        
2017-03-09 18:18:18 UTC (rev 16421)
@@ -131,7 +131,7 @@
 
                        if ($export)
                        {
-                               $num_of_objects = null;
+                               $num_of_objects = 0;
                        }
 
                        //Retrieve a contract identifier and load corresponding 
contract

Modified: branches/Version-2_0-branch/rental/inc/model/class.invoice.inc.php
===================================================================
--- branches/Version-2_0-branch/rental/inc/model/class.invoice.inc.php  
2017-03-09 18:16:05 UTC (rev 16420)
+++ branches/Version-2_0-branch/rental/inc/model/class.invoice.inc.php  
2017-03-09 18:18:18 UTC (rev 16421)
@@ -326,7 +326,7 @@
                 * @param bool $override        flag to indicate if the invoice 
start period should be overridden with the billing start date of contract
                 * @param int $timestamp_invoice_start  the startdate of the 
invoice period
                 * @param int $timestamp_invoice_end    the enddate of the 
invoice period
-                * @param bool $bill_only_one_time      flag to indicate if the 
the invoice should only bil one time price elements
+                * @param bool $bill_only_one_time      flag to indicate if the 
the invoice should only bill one time price elements
                 * @return rental_invoice       the newly created invoice
                 */
                public static function create_invoice( int $decimals, int 
$billing_id, int $contract_id, bool $override, int $timestamp_invoice_start, 
int $timestamp_invoice_end, $bill_only_one_time, $dry_run = false, 
$billing_term = 0 )
@@ -355,33 +355,7 @@
                                }
                        }
 
-                       // Create invoice ...
-                       $invoice = new rental_invoice(
-                               -1, // no identifier
-                               $billing_id, // the billing identifier
-                               $contract_id, // the contract identifier
-                               time(), // the creation time
-                               $timestamp_invoice_start, // the invoice start 
date
-                               $timestamp_invoice_end, // the invoice end date
-                               0, // the total sum of invoice (not calculated 
yet)
-                               $contract->get_rented_area(), // the area 
rented on the contract
-                               $contract->get_invoice_header(), // the invoice 
header
-                               $contract->get_account_in(), // the ingoing 
account number
-                               $account_out, // the outgoing account number
-                               $contract->get_service_id(), // the service 
identifier (internal)
-                               $contract->get_responsibility_id() // the 
responsibility identifier (internal)
-                       );
 
-                       // ... and add party identifier, project number and the 
old contract identifier
-                       $invoice->set_party_id($contract->get_payer_id());
-                       $invoice->set_project_id($contract->get_project_id());
-                       
$invoice->set_old_contract_id($contract->get_old_contract_id());
-
-                       if (!$dry_run)
-                       {
-                               
rental_soinvoice::get_instance()->store($invoice); // We must store the invoice 
at this point to have an id to give to the price item
-                       }
-
                        // Retrieve the contract price items: only one-time or 
all
                        if ($bill_only_one_time)
                        {
@@ -400,7 +374,7 @@
                                                'year' => date('Y', 
$timestamp_invoice_start),
                                                'month' => date('m', 
$timestamp_invoice_start)
                                        );
-                                       }
+                               }
                                //$contract_price_items = 
$socontract_price_item->get($start_index, $num_of_objects, $sort_field, 
$sort_ascending, $search_for, $search_type, $filters2);
 
                                $contract_price_items = 
rental_socontract_price_item::get_instance()->get(0, 0, '', false, '', '', 
$filters2);
@@ -412,6 +386,43 @@
                                        'contract_id' => $contract->get_id()));
                        }
 
+                       // Run through the contract price items
+                       $_check_sum = 0;
+                       foreach ($contract_price_items as $contract_price_item)
+                       {
+                               $_check_sum += 
$contract_price_item->get_total_price();
+                       }
+                       if( !abs($_check_sum) > 0 )
+                       {
+                               return null;
+                       }
+                       // Create invoice ...
+                       $invoice = new rental_invoice(
+                               -1, // no identifier
+                               $billing_id, // the billing identifier
+                               $contract_id, // the contract identifier
+                               time(), // the creation time
+                               $timestamp_invoice_start, // the invoice start 
date
+                               $timestamp_invoice_end, // the invoice end date
+                               0, // the total sum of invoice (not calculated 
yet)
+                               $contract->get_rented_area(), // the area 
rented on the contract
+                               $contract->get_invoice_header(), // the invoice 
header
+                               $contract->get_account_in(), // the ingoing 
account number
+                               $account_out, // the outgoing account number
+                               $contract->get_service_id(), // the service 
identifier (internal)
+                               $contract->get_responsibility_id() // the 
responsibility identifier (internal)
+                       );
+
+                       // ... and add party identifier, project number and the 
old contract identifier
+                       $invoice->set_party_id($contract->get_payer_id());
+                       $invoice->set_project_id($contract->get_project_id());
+                       
$invoice->set_old_contract_id($contract->get_old_contract_id());
+
+                       if (!$dry_run)
+                       {
+                               
rental_soinvoice::get_instance()->store($invoice); // We must store the invoice 
at this point to have an id to give to the price item
+                       }
+
                        $total_sum = 0; // Holding the total price of the 
invoice
 
                        $contract_dates = $contract->get_contract_date();




reply via email to

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