[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11299] bkbooking: stavanger kommfakt implementasjon
From: |
Kjell Arne Espedal |
Subject: |
[Fmsystem-commits] [11299] bkbooking: stavanger kommfakt implementasjon |
Date: |
Wed, 18 Sep 2013 10:37:17 +0000 |
Revision: 11299
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11299
Author: kjell
Date: 2013-09-18 10:37:15 +0000 (Wed, 18 Sep 2013)
Log Message:
-----------
bkbooking: stavanger kommfakt implementasjon
Modified Paths:
--------------
branches/stavangerkommune/booking/inc/class.socompleted_reservation_export.inc.php
branches/stavangerkommune/booking/inc/class.socompleted_reservation_export_file.inc.php
branches/stavangerkommune/booking/inc/class.uiaccount_code_set.inc.php
branches/stavangerkommune/booking/inc/class.uicompleted_reservation.inc.php
branches/stavangerkommune/booking/inc/class.uicompleted_reservation_export.inc.php
branches/stavangerkommune/booking/inc/class.uicompleted_reservation_export_file.inc.php
branches/stavangerkommune/booking/templates/base/account_code_dimension.xsl
branches/stavangerkommune/booking/templates/base/account_code_set.xsl
branches/stavangerkommune/booking/templates/base/account_code_set_form.xsl
Modified:
branches/stavangerkommune/booking/inc/class.socompleted_reservation_export.inc.php
===================================================================
---
branches/stavangerkommune/booking/inc/class.socompleted_reservation_export.inc.php
2013-09-17 11:49:14 UTC (rev 11298)
+++
branches/stavangerkommune/booking/inc/class.socompleted_reservation_export.inc.php
2013-09-18 10:37:15 UTC (rev 11299)
@@ -283,7 +283,21 @@
* @return array with three elements where index 0: total_rows,
index 1: total_cost, index 2: formatted data
*/
public function export_external(array &$reservations, array
$account_codes) {
- $export_format = 'agresso';
+ $config = CreateObject('phpgwapi.config','booking');
+ $config->read();
+
+ if ($config->config_data['external_format'] == 'CSV')
+ {
+ $export_format = 'csv';
+ }
+ elseif ($config->config_data['external_format'] == 'AGGRESSO')
+ {
+ $export_format = 'agresso';
+ }
+ elseif ($config->config_data['external_format'] == 'KOMMFAKT')
+ {
+ $export_format = 'kommfakt';
+ }
if (is_array($reservations)) {
if (count($external_reservations =
array_filter($reservations, array($this, 'select_external'))) > 0) {
@@ -292,12 +306,33 @@
throw new
UnexpectedValueException("Unable to find sequential number generator for
external export");
}
- return $this->build_export_result(
+ if ($config->config_data['external_format'] == 'CSV')
+ {
+ return $this->build_export_result(
+ $export_format,
+
count(array_filter($internal_reservations, array($this, 'not_free'))),
+
$this->calculate_total_cost($internal_reservations),
+
$this->format_csv($internal_reservations, $account_codes, $number_generator)
+ );
+ }
+ elseif ($config->config_data['external_format'] ==
'AGGRESSO')
+ {
+ return
$this->build_export_result(
$export_format,
count(array_filter($external_reservations, array($this, 'not_free'))),
$this->calculate_total_cost($external_reservations),
$this->format_agresso($external_reservations, $account_codes, $number_generator)
- );
+ );
+ }
+ elseif ($config->config_data['external_format'] ==
'KOMMFAKT')
+ {
+ return
$this->build_export_result(
+ $export_format,
+
count(array_filter($external_reservations, array($this, 'not_free'))),
+
$this->calculate_total_cost($external_reservations),
+
$this->format_kommfakt($external_reservations, $account_codes,
$number_generator)
+ );
+ }
}
}
return $this->build_export_result($export_format, 0,
0.0);
@@ -318,6 +353,10 @@
{
$export_format = 'agresso';
}
+ elseif ($config->config_data['internal_format'] == 'KOMMFAKT')
+ {
+ $export_format = 'kommfakt';
+ }
if (is_array($reservations)) {
if (count($internal_reservations =
array_filter($reservations, array($this, 'select_internal'))) > 0) {
@@ -343,6 +382,15 @@
$this->format_agresso($internal_reservations, $account_codes, $number_generator)
);
}
+ elseif ($config->config_data['internal_format'] ==
'KOMMFAKT')
+ {
+ return
$this->build_export_result(
+ $export_format,
+
count(array_filter($internal_reservations, array($this, 'not_free'))),
+
$this->calculate_total_cost($internal_reservations),
+
$this->format_kommfakt($internal_reservations, $account_codes,
$number_generator)
+ );
+ }
}
}
return $this->build_export_result($export_format, 0,
0.0);
@@ -397,6 +445,7 @@
$combined_data = array();
$export_format = null;
$combine_method = null;
+
foreach($export_results as &$export_result) {
if (!isset($export_result['export_format']) ||
!is_string($export_result['export_format'])) {
throw new
InvalidArgumentException('export_format must be specified');
@@ -435,7 +484,7 @@
$combined_data[] = substr($export['data'],
strpos($export['data'], "\n")+1); //Remove first line (i.e don't to repeat
headers in file)
}
}
-
+
public function format_csv(array &$reservations, array
$account_codes, $sequential_number_generator) {
$export_info = array();
$output = array();
@@ -710,7 +759,7 @@
$header['line_no'] = '0000'; //Nothing
here according to example file but spec. says so
//Topptekst til faktura, knyttet mot
fagavdeling
- $header['long_info1'] =
str_pad(substr(iconv("utf-8","ISO-8859-1",$account_codes['invoice_instruction']),
0, 120), 120, ' ');
+ $header['long_info1'] =
str_pad(substr(iconv("utf-8","ISO-8859-1//TRANSLIT",$account_codes['invoice_instruction']),
0, 120), 120, ' ');
//Ordrenr. UNIKT, løpenr. genereres i
booking ut fra gitt serie, eks. 38000000
$header['order_id'] =
str_pad($order_id, 9, 0, STR_PAD_LEFT);
@@ -741,7 +790,7 @@
/* Data hentes fra booking, tidspunkt
legges i eget felt som kommer på
* linjen under: 78_short_info. <navn
på bygg>, <navn på ressurs>
*/
- $item['art_descr'] =
str_pad(substr(iconv("utf-8","ISO-8859-1",$reservation['article_description']),
0, 35), 35, ' '); //35 chars long
+ $item['art_descr'] =
str_pad(substr(iconv("utf-8","ISO-8859-1//TRANSLIT",$reservation['article_description']),
0, 35), 35, ' '); //35 chars long
//Artikkel opprettes i Agresso (4
siffer), en for kultur og en for idrett, inneholder konteringsinfo.
$item['article'] =
str_pad(substr(strtoupper($account_codes['article']), 0, 15), 15, ' ');
@@ -797,7 +846,7 @@
$text['batch_id'] = $header['batch_id'];
$text['client'] = $header['client'];
$text['line_no'] = $item['line_no'];
- $text['short_info'] =
str_pad(substr(iconv("utf-8","ISO-8859-1",$reservation['description']), 0, 60),
60, ' ');
+ $text['short_info'] =
str_pad(substr(iconv("utf-8","ISO-8859-1//TRANSLIT",$reservation['description']),
0, 60), 60, ' ');
$text['trans_type'] =
$header['trans_type'];
$text['voucher_type'] =
$header['voucher_type'];
@@ -855,7 +904,7 @@
/* Data hentes fra booking, tidspunkt
legges i eget felt som kommer på
* linjen under: 78_short_info. <navn
på bygg>, <navn på ressurs>
*/
- $item['art_descr'] =
str_pad(substr(iconv("utf-8","ISO-8859-1",$reservation['article_description']),
0, 35), 35, ' '); //35 chars long
+ $item['art_descr'] =
str_pad(substr(iconv("utf-8","ISO-8859-1//TRANSLIT",$reservation['article_description']),
0, 35), 35, ' '); //35 chars long
//Artikkel opprettes i Agresso (4
siffer), en for kultur og en for idrett, inneholder konteringsinfo.
$item['article'] =
str_pad(substr(strtoupper($account_codes['article']), 0, 15), 15, ' ');
@@ -911,7 +960,7 @@
$text['batch_id'] =
$stored_header['batch_id'];
$text['client'] =
$stored_header['client'];
$text['line_no'] = $item['line_no'];
- $text['short_info'] =
str_pad(substr(iconv("utf-8","ISO-8859-1",$reservation['description']), 0, 60),
60, ' ');
+ $text['short_info'] =
str_pad(substr(iconv("utf-8","ISO-8859-1//TRANSLIT",$reservation['description']),
0, 60), 60, ' ');
$text['trans_type'] =
$stored_header['trans_type'];
$text['voucher_type'] =
$stored_header['voucher_type'];
@@ -944,4 +993,203 @@
$row_template = array('accept_flag' => str_repeat(' ',
1), 'account' => str_repeat(' ', 8), 'accountable' => str_repeat(' ', 20),
'address' => str_repeat(' ', 160), 'allocation_key' => str_repeat(' ', 2),
'amount' => str_repeat(' ', 17), 'amount_set' => str_repeat(' ', 1), 'apar_id'
=> str_repeat(' ', 8), 'apar_name' => str_repeat(' ', 30), 'art_descr' =>
str_repeat(' ', 35), 'article' => str_repeat(' ', 15), 'att_1_id' =>
str_repeat(' ', 2), 'att_2_id' => str_repeat(' ', 2), 'att_3_id' =>
str_repeat(' ', 2), 'att_4_id' => str_repeat(' ', 2), 'att_5_id' =>
str_repeat(' ', 2), 'att_6_id' => str_repeat(' ', 2), 'att_7_id' =>
str_repeat(' ', 2), 'bank_account' => str_repeat(' ', 35), 'batch_id' =>
str_repeat(' ', 12), 'client' => str_repeat(' ', 2), 'client_ref' =>
str_repeat(' ', 2), 'confirm_date' => str_repeat(' ', 17), 'control' =>
str_repeat(' ', 1), 'cur_amount' => str_repeat(' ', 17), 'currency' =>
str_repeat(' ', 3), 'del_met_descr' => str_repeat(' ', 60), 'del_term_descr' =>
str_repeat(' ', 60), 'deliv_addr' => str_repeat(' ', 255), 'deliv_attention' =>
str_repeat(' ', 50), 'deliv_countr' => str_repeat(' ', 3), 'deliv_date' =>
str_repeat(' ', 17), 'deliv_method' => str_repeat(' ', 8), 'deliv_terms' =>
str_repeat(' ', 8), 'dim_1' => str_repeat(' ', 8), 'dim_2' => str_repeat(' ',
8), 'dim_3' => str_repeat(' ', 8), 'dim_4' => str_repeat(' ', 8), 'dim_5' =>
str_repeat(' ', 12), 'dim_6' => str_repeat(' ', 4), 'dim_7' => str_repeat(' ',
4), 'dim_value_1' => str_repeat(' ', 12), 'dim_value_2' => str_repeat(' ', 12),
'dim_value_3' => str_repeat(' ', 12), 'dim_value_4' => str_repeat(' ', 12),
'dim_value_5' => str_repeat(' ', 12), 'dim_value_6' => str_repeat(' ', 12),
'dim_value_7' => str_repeat(' ', 12), 'disc_percent' => str_repeat(' ', 17),
'exch_rate' => str_repeat(' ', 17), 'ext_ord_ref' => str_repeat(' ', 15),
'intrule_id' => str_repeat(' ', 6), 'line_no' => str_repeat(' ', 4), 'location'
=> str_repeat(' ', 4), 'long_info1' => str_repeat(' ', 120), 'long_info2' =>
str_repeat(' ', 120), 'lot' => str_repeat(' ', 10), 'main_apar_id' =>
str_repeat(' ', 8), 'mark_attention' => str_repeat(' ', 50), 'mark_ctry_cd' =>
str_repeat(' ', 3), 'markings' => str_repeat(' ', 120), 'obs_date' =>
str_repeat(' ', 17), 'order_date' => str_repeat(' ', 17), 'order_id' =>
str_repeat(' ', 9), 'order_type' => str_repeat(' ', 2), 'pay_method' =>
str_repeat(' ', 2), 'period' => str_repeat(' ', 8), 'place' => str_repeat(' ',
30), 'province' => str_repeat(' ', 40), 'rel_value' => str_repeat(' ', 12),
'responsible' => str_repeat(' ', 8), 'responsible2' => str_repeat(' ', 8),
'sequence_no' => str_repeat(' ', 8), 'sequence_ref' => str_repeat(' ', 8),
'serial_no' => str_repeat(' ', 20), 'short_info' => str_repeat(' ', 60),
'status' => str_repeat(' ', 1), 'tax_code' => str_repeat(' ', 2), 'tax_system'
=> str_repeat(' ', 2), 'template_id' => str_repeat(' ', 8), 'terms_id' =>
str_repeat(' ', 2), 'tekx1' => str_repeat(' ', 12), 'tekst2' => str_repeat(' ',
12), 'tekst3' => str_repeat(' ', 12), 'text4' => str_repeat(' ', 12),
'trans_type' => str_repeat(' ', 2), 'unit_code' => str_repeat(' ', 3),
'unit_descr' => str_repeat(' ', 50), 'value_1' => str_repeat(' ', 17),
'voucher_ref' => str_repeat(' ', 9), 'voucher_type' => str_repeat(' ', 2),
'warehouse' => str_repeat(' ', 4), 'zip_code' => str_repeat(' ', 15));
return $row_template;
}
+
+ protected function combine_kommfakt_export_data(array
&$combined_data, $export) {
+ if (count($combined_data) == 0) {
+ $combined_data[] = $export['data'];
+ } else {
+ $combined_data[] = "\n";
+ $combined_data[] = $export['data'];
+ }
+ }
+
+ public function format_kommfakt(array &$reservations, array
$account_codes, $sequential_number_generator) {
+ $export_info = array();
+ $output = array();
+
+ $log = array();
+
+ $date = str_pad(date('Ymd'), 17, ' ', STR_PAD_LEFT);
+
+ $config = CreateObject('phpgwapi.config','booking');
+ $config->read();
+
+
+
+ $stored_header = array();
+ $line_no = 0;
+ $header_count = 0;
+ $log_order_id = '';
+ $log_customer_name = '';
+ $log_customer_nr = '';
+ $log_buidling = '';
+
+ $internal = false;
+
+ $ant_post = 0;
+ $linjenr = 1;
+ $lopenr = 1;
+
+ foreach($reservations as &$reservation) {
+
+ if ($this->get_cost_value($reservation['cost'])
<= 0) {
+ continue; //Don't export costless rows
+ }
+
+ if(!empty($reservation['organization_id'])) {
+ $org =
$this->organization_bo->read_single($reservation['organization_id']);
+ $reservation['organization_name'] =
$org['name'];
+ } else {
+ $data =
$this->event_so->get_org($reservation['customer_organization_number']);
+ if(!empty($data['id'])) {
+
$reservation['organization_name'] = $data['name'];
+ } else {
+
if($reservation['reservation_type'] == 'event') {
+ $data =
$this->event_bo->read_single($reservation['reservation_id']);
+
$reservation['organization_name'] = $data['contact_name'];
+# } elseif
($reservation['reservation_type'] == 'booking') {
+# $data =
$this->booking_bo->read_single($reservation['reservation_id']);
+#
error_log('b'.$data['id']." ".$data['group_id']);
+# } else {
+# $data =
$this->allocation_bo->read_single($reservation['reservation_id']);
+#
error_log('a'.$data['id']." ".$data['organization_id']);
+ }
+ }
+ }
+
+ $type = $reservation['customer_type'];
+
+ $order_id =
$sequential_number_generator->increment()->get_current();
+ $export_info[] =
$this->create_export_item_info($reservation, $order_id);
+ $header_count += 1;
+ $stored_header['kundenr'] = $kundenr;
+
+ $kundenr =
str_pad(substr($this->get_customer_identifier_value_for($reservation), 0, 11),
11, '0',STR_PAD_LEFT);
+
+
+ if
(strlen($this->get_customer_identifier_value_for($reservation)) > 9) {
+ $name =
str_pad(iconv("utf-8","ISO-8859-1//TRANSLIT",$reservation['organization_name']),
30, ' ');
+ } else {
+ $name =
str_pad(iconv("utf-8","ISO-8859-1//TRANSLIT",$reservation['organization_name']),
30, ' ');
+ }
+
+ //Startpost ST
+ $startpost =
$this->get_kommfakt_ST_row_template();
+ $startpost['posttype'] = 'ST';
+ $startpost['referanse'] =
str_pad(substr(iconv("utf-8","ISO-8859-1//TRANSLIT",$reservation['article_description']),
0, 60), 60, ' ');
+# $startpost['referanse'] =
str_pad(substr(iconv("utf-8","ISO-8859-1//TRANSLIT",$account_codes['invoice_instruction']),
0, 60), 60, ' ');
+
+ //Fakturalinje FL
+ $fakturalinje =
$this->get_kommfakt_FL_row_template();
+ $fakturalinje['posttype'] = 'FL';
+ $fakturalinje['kundenr'] = $kundenr;
+ $fakturalinje['navn'] = $name;
+# $fakturalinje['adresse1'] = ;
+# $fakturalinje['adresse2'] = ;
+# $fakturalinje['postnr'] = ;
+ $fakturalinje['betform'] = 'BG';
+ $fakturalinje['oppdrgnr'] =
str_pad(iconv("utf-8","ISO-8859-1//TRANSLIT",$account_codes['object_number']),
3, '0', STR_PAD_LEFT);
+ $fakturalinje['varenr'] =
str_pad(iconv("utf-8","ISO-8859-1//TRANSLIT",$account_codes['responsible_code']),
4, '0', STR_PAD_LEFT);
+ $fakturalinje['lopenr'] =
str_pad(iconv("utf-8","ISO-8859-1//TRANSLIT",$lopenr), 2, '0', STR_PAD_LEFT);
+ $fakturalinje['pris'] =
str_pad($reservation['cost']*100,8,'0',STR_PAD_LEFT).' ';
+ $fakturalinje['grunnlag'] = '000000001';
+ $fakturalinje['belop'] =
str_pad($reservation['cost']*100,8,'0',STR_PAD_LEFT).' ';
+# $fakturalinje['saksnr'] = ;
+
+ //Linjetekst LT
+ $linjetekst =
$this->get_kommfakt_LT_row_template();
+ $linjetekst['posttype'] = 'LT';
+ $linjetekst['kundenr'] = $kundenr;
+ $linjetekst['oppdrgnr'] =
str_pad(iconv("utf-8","ISO-8859-1//TRANSLIT",$account_codes['object_number']),
3, '0', STR_PAD_LEFT);
+ $linjetekst['varenr'] =
str_pad(iconv("utf-8","ISO-8859-1//TRANSLIT",$account_codes['responsible_code']),
4, '0', STR_PAD_LEFT) ;
+ $linjetekst['lopenr'] =
str_pad(iconv("utf-8","ISO-8859-1//TRANSLIT",$lopenr), 2, '0', STR_PAD_LEFT);
+ $linjetekst['linjenr'] = $linjenr;
+ $linjetekst['tekst'] =
str_pad(iconv("utf-8","ISO-8859-1//TRANSLIT",$reservation['description']), 50,
' ');
+ $ant_post += 3;
+
+ //Sluttpost SL
+ $sluttpost =
$this->get_kommfakt_SL_row_template();
+ $sluttpost['posttype'] = 'SL';
+ $sluttpost['antpost'] =
str_pad(intval($ant_post)+1, 8, '0', STR_PAD_LEFT);
+ $ant_post = 0;
+
+
+ $log_order_id = $order_id;
+
+ if(!empty($reservation['organization_id'])) {
+ $org =
$this->organization_bo->read_single($reservation['organization_id']);
+ $log_customer_name = $org['name'];
+ } else {
+ $data =
$this->event_so->get_org($reservation['customer_organization_number']);
+ if(!empty($data['id'])) {
+ $log_customer_name =
$data['name'];
+ } else {
+
if($reservation['reservation_type'] == 'event') {
+ $data =
$this->event_bo->read_single($reservation['reservation_id']);
+ $log_customer_name =
$data['contact_name'];
+# } elseif
($reservation['reservation_type'] == 'booking') {
+# $data =
$this->booking_bo->read_single($reservation['reservation_id']);
+#
error_log('b'.$data['id']." ".$data['group_id']);
+# } else {
+# $data =
$this->allocation_bo->read_single($reservation['reservation_id']);
+#
error_log('a'.$data['id']." ".$data['organization_id']);
+ }
+ }
+ }
+
+ $log_customer_nr =
$this->get_customer_identifier_value_for($reservation);
+ $log_buidling = $reservation['building_name'];
+ $log_cost = $reservation['cost'];
+ $log_varelinjer_med_dato =
$reservation['article_description'].' - '.$reservation['description'];
+
+ $log[] = $log_order_id.';'.$log_customer_name.'
-
'.$log_customer_nr.';'.$log_varelinjer_med_dato.';'.$log_buidling.';'.$log_cost;
+
+ $output[] = implode('', str_replace(array("\n",
"\r"), '', $startpost));
+ $output[] = implode('', str_replace(array("\n",
"\r"), '', $fakturalinje));
+ $output[] = implode('', str_replace(array("\n",
"\r"), '', $linjetekst));
+ $output[] = implode('', str_replace(array("\n",
"\r"), '', $sluttpost));
+
+ }
+
+ if (count($export_info) == 0) {
+ return null;
+ }
+
+
+ return array('data' => implode("\r\n", $output),
'data_log' => implode("\n", $log), 'info' => $export_info, 'header_count' =>
$header_count);
+
+ }
+
+ protected function get_kommfakt_ST_row_template() {
+ static $row_template = false;
+ if ($row_template) { return $row_template; }
+
+ $row_template = array('posttype' => str_repeat(' ', 2),
'referanse' => str_repeat(' ', 60));
+ return $row_template;
+ }
+
+ protected function get_kommfakt_FL_row_template() {
+ static $row_template = false;
+ if ($row_template) { return $row_template; }
+
+ $row_template = array('posttype' => str_repeat(' ', 2),
'kundenr' => str_repeat(' ', 11), 'navn' => str_repeat(' ', 30), 'adresse1' =>
str_repeat(' ', 30), 'adresse2' => str_repeat(' ', 30), 'postnr' =>
str_repeat(' ', 4), 'betform' => str_repeat(' ', 2), 'oppdrgnr' => str_repeat('
', 3), 'varenr' => str_repeat(' ', 4), 'lopenr' => str_repeat(' ', 2), 'pris'
=> str_repeat(' ', 9), 'grunnlag' => str_repeat(' ', 9), 'belop' =>
str_repeat(' ', 11), 'saksnr' => str_repeat(' ', 16));
+ return $row_template;
+
+ }
+
+ protected function get_kommfakt_LT_row_template() {
+ static $row_template = false;
+ if ($row_template) { return $row_template; }
+
+ $row_template = array('posttype' => str_repeat(' ', 2),
'kundenr' => str_repeat(' ', 11), 'oppdrgnr' => str_repeat(' ', 3), 'varenr' =>
str_repeat(' ', 4), 'lopenr' => str_repeat(' ', 2), 'linjenr' => str_repeat('
', 2), 'tekst' => str_repeat(' ', 50));
+ return $row_template;
+ }
+
+ protected function get_kommfakt_SL_row_template() {
+ static $row_template = false;
+ if ($row_template) { return $row_template; }
+
+ $row_template = array('posttype' => str_repeat(' ', 2),
'antpost' => str_repeat(' ', 8));
+ return $row_template;
+ }
}
Modified:
branches/stavangerkommune/booking/inc/class.socompleted_reservation_export_file.inc.php
===================================================================
---
branches/stavangerkommune/booking/inc/class.socompleted_reservation_export_file.inc.php
2013-09-17 11:49:14 UTC (rev 11298)
+++
branches/stavangerkommune/booking/inc/class.socompleted_reservation_export_file.inc.php
2013-09-18 10:37:15 UTC (rev 11299)
@@ -47,8 +47,23 @@
{
return 'txt';
}
+ elseif ($config->config_data['internal_format'] == 'KOMMFAKT')
+ {
+ return 'txt';
+ }
} elseif ($export_type === 'external'){
- return 'txt';
+ if ($config->config_data['external_format'] == 'CSV')
+ {
+ return 'csv';
+ }
+ elseif ($config->config_data['external_format'] == 'AGGRESSO')
+ {
+ return 'txt';
+ }
+ elseif ($config->config_data['external_format'] == 'KOMMFAKT')
+ {
+ return 'txt';
+ }
} else {
return 'txt';
}
@@ -110,7 +125,7 @@
$entity_export_files = array();
$export_files = array();
$export_conf_updates = array();
-
+
try {
$this->db->transaction_begin();
@@ -133,6 +148,7 @@
if ($export_type == 'external') {
$export_result['total_items'] = $export_result['export']['header_count'];
+
if
(!is_null($export_result['export']['data_log'])) {
$export_log .=
$export_result['export']['data_log'];
} else {
@@ -156,7 +172,7 @@
}
foreach($export_types as $export_type) {
- $entity_export_file = array();
+ $entity_export_file = array();
$entity_export_file['type'] =
$export_type;
$entity_export_file['total_cost'] =
$total_cost[$export_type];
$entity_export_file['total_items'] =
$total_items[$export_type];
@@ -167,7 +183,7 @@
$entity_export_file['filename'] =
'export_'.$export_type.'_'.$entity_export_file['id'].'.'.$this->file_type_for_export_type($export_type);
$export_file = new
booking_storage_object($entity_export_file['filename']);
$export_files[] = $export_file;
-
+
$export_file->set_data($export_data[$export_type]);
$this->file_storage->attach($export_file)->persist();
Modified: branches/stavangerkommune/booking/inc/class.uiaccount_code_set.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.uiaccount_code_set.inc.php
2013-09-17 11:49:14 UTC (rev 11298)
+++ branches/stavangerkommune/booking/inc/class.uiaccount_code_set.inc.php
2013-09-18 10:37:15 UTC (rev 11299)
@@ -85,14 +85,14 @@
$data['datatable']['field'][] = array('key' => 'name',
'label' => lang('Name'), 'formatter' => 'YAHOO.booking.formatLink');
if (isset($config->config_data['dim_3']))
$data['datatable']['field'][] = array('key' => 'object_number', 'label' =>
$config->config_data['dim_3']);
if (isset($config->config_data['dim_1']))
$data['datatable']['field'][] = array('key' => 'responsible_code', 'label' =>
$config->config_data['dim_1']);
- $data['datatable']['field'][] = array('key' =>
'article', 'label' => lang('Article'));
+ if (isset($config->config_data['article']))
$data['datatable']['field'][] = array('key' => 'article', 'label' =>
lang('Article'));
if (isset($config->config_data['dim_2']))
$data['datatable']['field'][] = array('key' => 'service', 'label' =>
$config->config_data['dim_2']);
if (isset($config->config_data['dim_4']))
$data['datatable']['field'][] = array('key' => 'dim_4', 'label' =>
$config->config_data['dim_4']);
if (isset($config->config_data['dim_5']))
$data['datatable']['field'][] = array('key' => 'project_number', 'label' =>
$config->config_data['dim_5']);
if (isset($config->config_data['dim_value_1']))
$data['datatable']['field'][] = array('key' => 'unit_number', 'label' =>
$config->config_data['dim_value_1']);
if (isset($config->config_data['dim_value_4']))
$data['datatable']['field'][] = array('key' => 'dim_value_4', 'label' =>
$config->config_data['dim_value_4']);
if (isset($config->config_data['dim_value_5']))
$data['datatable']['field'][] = array('key' => 'dim_value_5', 'label' =>
$config->config_data['dim_value_5']);
- $data['datatable']['field'][] = array('key' =>
'unit_prefix', 'label' => lang('Unit prefix'));
+ if ($config->config_data['external_format'] !=
'KOMMFAKT') $data['datatable']['field'][] = array('key' => 'unit_prefix',
'label' => lang('Unit prefix'));
$data['datatable']['field'][] = array('key' => 'link',
'hidden' => true);
if ($this->bo->allow_create()) {
@@ -169,6 +169,13 @@
{
$account_code_set = extract_values($_POST,
$this->fields);
$account_code_set['active'] = '1';
+ if ($config->config_data['external_format'] ==
'KOMMFAKT') {
+ $account_code_set['article'] = '1';
+ $account_code_set['service'] = '1';
+ $account_code_set['project_number'] =
'1';
+ $account_code_set['unit_number'] = '1';
+ $account_code_set['unit_prefix'] = '1';
+ }
$errors =
$this->bo->validate($account_code_set);
if(!$errors)
@@ -182,7 +189,9 @@
}
}
$this->add_default_display_data($account_code_set);
- $account_code_set['project_number'] = '9';
+ if ($config->config_data['external_format'] !=
'KOMMFAKT') {
+ $account_code_set['project_number'] = '9';
+ }
$account_code_set['cancel_link'] =
$this->link_to('index');
$this->flash_form_errors($errors);
self::render_template('account_code_set_form',
array('new_form' => true, 'account_code_set' => $account_code_set ,
'config_data' => $config->config_data));
Modified:
branches/stavangerkommune/booking/inc/class.uicompleted_reservation.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.uicompleted_reservation.inc.php
2013-09-17 11:49:14 UTC (rev 11298)
+++ branches/stavangerkommune/booking/inc/class.uicompleted_reservation.inc.php
2013-09-18 10:37:15 UTC (rev 11299)
@@ -250,7 +250,9 @@
}
}
- $filter_to = phpgw::get_var('filter_to', 'string',
'REQUEST', null);
+ $to = strtotime(phpgw::get_var('filter_to', 'string',
'REQUEST', null));
+ $filter_to = date("Y-m-d",$to);
+
if ($filter_to) {
$filters['where'][] = "%%table%%".sprintf(".to_
<= '%s 23:59:59'", $GLOBALS['phpgw']->db->db_addslashes($filter_to));
}
Modified:
branches/stavangerkommune/booking/inc/class.uicompleted_reservation_export.inc.php
===================================================================
---
branches/stavangerkommune/booking/inc/class.uicompleted_reservation_export.inc.php
2013-09-17 11:49:14 UTC (rev 11298)
+++
branches/stavangerkommune/booking/inc/class.uicompleted_reservation_export.inc.php
2013-09-18 10:37:15 UTC (rev 11299)
@@ -187,8 +187,11 @@
)
);
}
- $data['filters'] = extract_values($_GET, array("filter_to"));
+ $filters_to = strtotime(extract_values($_GET,
array("filter_to")));
+ $data['filters'] = date("Y-m-d",$filters_to);
+
+
$this->render_template('datatable', $data);
}
Modified:
branches/stavangerkommune/booking/inc/class.uicompleted_reservation_export_file.inc.php
===================================================================
---
branches/stavangerkommune/booking/inc/class.uicompleted_reservation_export_file.inc.php
2013-09-17 11:49:14 UTC (rev 11298)
+++
branches/stavangerkommune/booking/inc/class.uicompleted_reservation_export_file.inc.php
2013-09-18 10:37:15 UTC (rev 11299)
@@ -144,7 +144,7 @@
$this->db = $GLOBALS['phpgw']->db;
$config = CreateObject('phpgwapi.config','booking');
$config->read();
- if ($config->config_data['output_files'] == 'single')
+# if ($config->config_data['output_files'] == 'single')
$export_files = $this->bo->read();
array_walk($export_files["results"], array($this,
"_add_links"), $this->module.".uicompleted_reservation_export_file.show");
foreach($export_files["results"] as &$export_file) {
Modified:
branches/stavangerkommune/booking/templates/base/account_code_dimension.xsl
===================================================================
--- branches/stavangerkommune/booking/templates/base/account_code_dimension.xsl
2013-09-17 11:49:14 UTC (rev 11298)
+++ branches/stavangerkommune/booking/templates/base/account_code_dimension.xsl
2013-09-18 10:37:15 UTC (rev 11299)
@@ -71,12 +71,44 @@
</dl>
<div class="clr"/>
<dl class="form">
- <dt class="heading"><xsl:value-of select="php:function('lang',
'Internal account')"/></dt>
+ <dt class="heading"><xsl:value-of select="php:function('lang',
'External account')"/></dt>
</dl>
- <p><xsl:value-of select="php:function('lang',
'Internal_account_helptext')"/></p>
+ <p><xsl:value-of select="php:function('lang',
'External_account_helptext')"/></p>
<dl class="form-col">
+ <dt><label for="field_external_format"><xsl:value-of
select="php:function('lang', 'External customer output format')"/></label></dt>
+ <dd>
+ <select id="field_external_format"
name="external_format">
+ <option value="AGGRESSO">
+ <xsl:if test="config_data/external_format='AGGRESSO'">
+ <xsl:attribute
name="selected">checked</xsl:attribute>
+ </xsl:if>
+ AGGRESSO
+ </option>
+ <option value="CSV">
+ <xsl:if test="config_data/external_format='CSV'">
+ <xsl:attribute
name="selected">checked</xsl:attribute>
+ </xsl:if>
+ CSV
+ </option>
+ <option value="KOMMFAKT">
+ <xsl:if test="config_data/external_format='KOMMFAKT'">
+ <xsl:attribute
name="selected">checked</xsl:attribute>
+ </xsl:if>
+ KOMMFAKT
+ </option>
+ </select>
+ </dd>
+ </dl>
+
+ <div class="clr"/>
+ <dl class="form">
+ <dt class="heading"><xsl:value-of select="php:function('lang',
'Internal account')"/></dt>
+ </dl>
+
+ <p><xsl:value-of select="php:function('lang',
'Internal_account_helptext')"/></p>
+ <dl class="form-col">
<dt><label for="field_organization_value"><xsl:value-of
select="php:function('lang', 'Organization number')"/></label></dt>
<dd>
<input id="field_organization_value"
name="organization_value" type="text">
@@ -98,6 +130,12 @@
</xsl:if>
CSV
</option>
+ <option value="KOMMFAKT">
+ <xsl:if test="config_data/internal_format='KOMMFAKT'">
+ <xsl:attribute
name="selected">checked</xsl:attribute>
+ </xsl:if>
+ KOMMFAKT
+ </option>
</select>
</dd>
<dt><label for="field_output_files"><xsl:value-of
select="php:function('lang', 'File output')"/></label></dt>
Modified: branches/stavangerkommune/booking/templates/base/account_code_set.xsl
===================================================================
--- branches/stavangerkommune/booking/templates/base/account_code_set.xsl
2013-09-17 11:49:14 UTC (rev 11298)
+++ branches/stavangerkommune/booking/templates/base/account_code_set.xsl
2013-09-18 10:37:15 UTC (rev 11299)
@@ -24,8 +24,10 @@
<dd><xsl:value-of
select="account_code_set/object_number"/></dd>
</xsl:if>
- <dt><xsl:value-of select="php:function('lang',
'Article')" /></dt>
- <dd><xsl:value-of
select="account_code_set/article"/></dd>
+ <xsl:if test="config_data/article">
+ <dt><xsl:value-of select="php:function('lang',
'Article')" /></dt>
+ <dd><xsl:value-of
select="account_code_set/article"/></dd>
+ </xsl:if>
<xsl:if test="config_data/dim_value_1">
<dt><xsl:value-of
select="config_data/dim_value_1" /></dt>
@@ -42,8 +44,10 @@
<dd><xsl:value-of
select="account_code_set/dim_value_5"/></dd>
</xsl:if>
- <dt><xsl:value-of select="php:function('lang', 'Unit
Prefix')" /></dt>
- <dd><xsl:value-of
select="account_code_set/unit_prefix"/></dd>
+ <xsl:if test="config_data/external_format !=
'KOMMFAKT'">
+ <dt><xsl:value-of select="php:function('lang',
'Unit Prefix')" /></dt>
+ <dd><xsl:value-of
select="account_code_set/unit_prefix"/></dd>
+ </xsl:if>
</dl>
<dl class="proplist-col">
@@ -68,10 +72,15 @@
</xsl:if>
</dl>
- <dl class="proplist">
- <dt><xsl:value-of select="php:function('lang', 'Invoice
instruction')" /></dt>
- <div class="description"><xsl:value-of
select="account_code_set/invoice_instruction"/></div>
- </dl>
+ <dl class="proplist">
+ <xsl:if test="config_data/external_format !=
'KOMMFAKT'">
+ <dt><xsl:value-of
select="php:function('lang', 'Invoice instruction')" /></dt>
+ </xsl:if>
+ <xsl:if test="config_data/external_format =
'KOMMFAKT'">
+ <dt><xsl:value-of
select="php:function('lang', 'Reference')" /></dt>
+ </xsl:if>
+ <div class="description"><xsl:value-of
select="account_code_set/invoice_instruction"/></div>
+ </dl>
<xsl:if test="account_code_set/permission/write">
<div class="form-buttons">
Modified:
branches/stavangerkommune/booking/templates/base/account_code_set_form.xsl
===================================================================
--- branches/stavangerkommune/booking/templates/base/account_code_set_form.xsl
2013-09-17 11:49:14 UTC (rev 11298)
+++ branches/stavangerkommune/booking/templates/base/account_code_set_form.xsl
2013-09-18 10:37:15 UTC (rev 11299)
@@ -30,6 +30,29 @@
<dt><label for="field_name"><xsl:value-of
select="php:function('lang', 'Name')" /></label></dt>
<dd><input name="name" type="text"
id="field_name" value="{account_code_set/name}"/></dd>
</dl>
+ <dl class="form-col">
+ <dt><label for="field_active"><xsl:value-of
select="php:function('lang', 'Active')"/></label></dt>
+ <dd>
+ <select id="field_active" name="active">
+ <xsl:if test="new_form">
+ <xsl:attribute
name="disabled">disabled</xsl:attribute>
+ </xsl:if>
+
+ <option value="1">
+ <xsl:if
test="account_code_set/active=1">
+ <xsl:attribute
name="selected">selected</xsl:attribute>
+ </xsl:if>
+ <xsl:value-of
select="php:function('lang', 'Active')"/>
+ </option>
+ <option value="0">
+ <xsl:if
test="account_code_set/active=0">
+ <xsl:attribute
name="selected">selected</xsl:attribute>
+ </xsl:if>
+ <xsl:value-of
select="php:function('lang', 'Inactive')"/>
+ </option>
+ </select>
+ </dd>
+ </dl>
<div class="clr"/>
@@ -59,33 +82,13 @@
<dd><input name="dim_value_5"
type="text" id="field_dim_value_5" value="{account_code_set/dim_value_5}"
maxlength='12'/></dd>
</xsl:if>
- <dt><label
for="field_unit_prefix"><xsl:value-of select="php:function('lang', 'Unit
Prefix')" /></label></dt>
- <dd><input name="unit_prefix" type="text"
id="field_unit_prefix" value="{account_code_set/unit_prefix}"
maxlength='1'/></dd>
+ <xsl:if test="config_data/external_format!=
'KOMMFAKT'">
+ <dt><label
for="field_unit_prefix"><xsl:value-of select="php:function('lang', 'Unit
Prefix')" /></label></dt>
+ <dd><input name="unit_prefix"
type="text" id="field_unit_prefix" value="{account_code_set/unit_prefix}"
maxlength='1'/></dd>
+ </xsl:if>
</dl>
<dl class="form-col">
- <dt><label for="field_active"><xsl:value-of
select="php:function('lang', 'Active')"/></label></dt>
- <dd>
- <select id="field_active" name="active">
- <xsl:if test="new_form">
- <xsl:attribute
name="disabled">disabled</xsl:attribute>
- </xsl:if>
-
- <option value="1">
- <xsl:if
test="account_code_set/active=1">
- <xsl:attribute
name="selected">selected</xsl:attribute>
- </xsl:if>
- <xsl:value-of
select="php:function('lang', 'Active')"/>
- </option>
- <option value="0">
- <xsl:if
test="account_code_set/active=0">
- <xsl:attribute
name="selected">selected</xsl:attribute>
- </xsl:if>
- <xsl:value-of
select="php:function('lang', 'Inactive')"/>
- </option>
- </select>
- </dd>
-
<xsl:if test="config_data/dim_1">
<dt><label
for="field_responsible_code"><xsl:value-of select="config_data/dim_1"
/></label></dt>
<dd><input name="responsible_code"
type="text" id="field_responsible_code"
value="{account_code_set/responsible_code}" maxlength='6'/></dd>
@@ -108,8 +111,14 @@
</dl>
<div class="clr"/>
+
<dl class="form">
+ <xsl:if test="config_data/external_format!= 'KOMMFAKT'">
<dt><label
for="field_invoice_instruction"><xsl:value-of select="php:function('lang',
'Invoice instruction')" /></label></dt>
+ </xsl:if>
+ <xsl:if test="config_data/external_format = 'KOMMFAKT'">
+ <dt><label
for="field_invoice_instruction"><xsl:value-of select="php:function('lang',
'Reference')" /></label></dt>
+ </xsl:if>
<dd><input size="120"
id="field_invoice_instruction" name="invoice_instruction"
value="{account_code_set/invoice_instruction}" /></dd>
</dl>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11299] bkbooking: stavanger kommfakt implementasjon,
Kjell Arne Espedal <=