[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [12041] rental: tune validation, excel export
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [12041] rental: tune validation, excel export |
Date: |
Sun, 27 Jul 2014 14:10:44 +0000 |
Revision: 12041
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=12041
Author: sigurdne
Date: 2014-07-27 14:10:43 +0000 (Sun, 27 Jul 2014)
Log Message:
-----------
rental: tune validation, excel export
Modified Paths:
--------------
trunk/rental/inc/model/class.agresso_gl07.inc.php
trunk/rental/inc/model/class.agresso_lg04.inc.php
trunk/rental/inc/model/class.contract.inc.php
Modified: trunk/rental/inc/model/class.agresso_gl07.inc.php
===================================================================
--- trunk/rental/inc/model/class.agresso_gl07.inc.php 2014-07-27 11:21:49 UTC
(rev 12040)
+++ trunk/rental/inc/model/class.agresso_gl07.inc.php 2014-07-27 14:10:43 UTC
(rev 12041)
@@ -44,6 +44,21 @@
public function get_missing_billing_info($contract)
{
+
+ //FIXME: Might have to check for this one...
+ /*
+ static $responsibility_arr = array();
+ static $responsibility_check = array();
+ if(!$responsibility_arr)
+ {
+ $responsibility_arr =
execMethod('property.bogeneric.get_list',array('type' =>
'responsibility_unit'));
+ foreach ($responsibility_arr as $responsibility_entry)
+ {
+
$responsibility_check[$responsibility_entry['id']] = true;
+ }
+ }
+ */
+
$missing_billing_info = array();
$payer_id = $contract->get_payer_id();
Modified: trunk/rental/inc/model/class.agresso_lg04.inc.php
===================================================================
--- trunk/rental/inc/model/class.agresso_lg04.inc.php 2014-07-27 11:21:49 UTC
(rev 12040)
+++ trunk/rental/inc/model/class.agresso_lg04.inc.php 2014-07-27 14:10:43 UTC
(rev 12041)
@@ -1,5 +1,6 @@
<?php
phpgw::import_class('rental.socomposite');
+ phpgw::import_class('rental.socontract');
include_class('rental', 'exportable', 'inc/model/');
class rental_agresso_lg04 implements rental_exportable
@@ -203,6 +204,12 @@
// HACK to get the needed location code for the
building
$building_location_code =
rental_socomposite::get_instance()->get_building_location_code($invoice->get_contract_id());
+ /**Sigurd:Start contract type**/
+ $contract =
rental_socontract::get_instance()->get_single($invoice->get_contract_id());
+ $current_contract_type_id =
$contract->get_contract_type_id();
+ $contract_type_label =
lang(rental_socontract::get_instance()->get_contract_type_label($current_contract_type_id));
+ /**End contract type**/
+
$price_item_data = array();
$price_item_counter = 0;
foreach($price_items as $price_item) // Runs
through all items
@@ -224,7 +231,25 @@
$party_name =
$serialized_party['name'];
$this->orders[] =
$this->$get_order_excel(
- $invoice->get_header(),
$invoice->get_party()->get_identifier(), $party_name, $invoice->get_id(),
$this->billing_job->get_year(), $this->billing_job->get_month(),
$invoice->get_account_out(), $data, $invoice->get_responsibility_id(),
$invoice->get_service_id(), $building_location_code,
$invoice->get_project_id(), $composite_name, $invoice->get_reference(),
$price_item_counter
+ $invoice->get_header(),
+
$invoice->get_party()->get_identifier(),
+ $party_name,
+ $invoice->get_id(),
+ $this->billing_job->get_year(),
+ $this->billing_job->get_month(),
+ $invoice->get_account_out(),
+ $data,
+
$invoice->get_responsibility_id(),
+ $invoice->get_service_id(),
+ $building_location_code,
+ $invoice->get_project_id(),
+ $composite_name,
+ $invoice->get_reference(),
+ $price_item_counter,
+ $invoice->get_account_in(),//ny
+
$invoice->get_responsibility_id(),//ny
+ $contract_type_label //ny
+
);
$price_item_counter++;
}
@@ -457,29 +482,26 @@
return str_replace(array("\n", "\r"), '', $order);
}
- protected function get_order_excel_nlsh($header, $party_id,
$party_name, $order_id, $bill_year, $bill_month, $account, $product_item,
$responsibility, $service, $building, $project, $text, $client_ref, $counter)
+ protected function get_order_excel_nlsh($header, $party_id,
$party_name, $order_id, $bill_year, $bill_month, $account_out, $product_item,
$responsibility, $service, $building, $project, $text, $client_ref,
$counter,$account_in,$responsibility_id, $contract_type_label)
{
- //$order_id = $order_id + 39500000;
- // XXX: Which charsets do Agresso accept/expect? Do we
need to something regarding padding and UTF-8?
- //$order = array();
-
+//_debug_array(func_get_args());
$item_counter = $counter;
$order = array
(
- 'Kontraktstype' =>
'Kontraktstype',//FIXME
- 'Art/konto inntektsside' => $account,
- 'Art/konto utgiftsside' => 'Art/konto
utgiftsside',//FIXME
+ 'Kontraktstype' =>
$contract_type_label,//FIXME
+ 'Art/konto inntektsside' => $account_in,
+ 'Art/konto utgiftsside' => $account_out,//FIXME
'client_ref' => $client_ref,
'header' =>
utf8_decode($header),
'bill_year' =>
$bill_year,
'bill_month' => $bill_month,
- 'Ansvar' =>
'BKBPE',//FIXME
- 'Ansvar2' =>
'BKBPE',//FIXME
+ 'Ansvar' =>
$responsibility_id,//FIXME
+// 'Ansvar2' =>
'BKBPE',//FIXME
'Party' =>
$party_id,
'name' =>
$party_name,
'amount' =>
$this->get_formatted_amount_excel($product_item['amount']),
-// 'amount' =>
$this->get_formatted_amount($product_items[0]['amount']),
+// 'amount' =>
$this->get_formatted_amount($product_items[0]['amount']),
'article description' =>
utf8_decode($product_item['article_description']),
'article_code' =>
$product_item['article_code'],
'batch_id' =>
"BKBPE{$this->date_str}",
Modified: trunk/rental/inc/model/class.contract.inc.php
===================================================================
--- trunk/rental/inc/model/class.contract.inc.php 2014-07-27 11:21:49 UTC
(rev 12040)
+++ trunk/rental/inc/model/class.contract.inc.php 2014-07-27 14:10:43 UTC
(rev 12041)
@@ -1156,6 +1156,11 @@
$this->set_validation_error('responsibility_id',
lang('responsibility_id_not_numeric'));
$valid_numeric = false;
}
+
+ if($this->get_responsibility_id() != null &&
is_numeric($this->get_responsibility_id()) && $this->get_responsibility_arr()){
+ $valid_numeric = true; // this one is ok
+ }
+
if($this->get_account_in() != null &&
!is_numeric($this->get_account_in())){
$this->set_validation_error('account_in',
lang('account_in_not_numeric'));
$valid_numeric = false;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [12041] rental: tune validation, excel export,
Sigurd Nes <=