[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8221] Merge 8218:8220 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [8221] Merge 8218:8220 from trunk |
Date: |
Wed, 30 Nov 2011 12:37:19 +0000 |
Revision: 8221
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8221
Author: sigurdne
Date: 2011-11-30 12:37:18 +0000 (Wed, 30 Nov 2011)
Log Message:
-----------
Merge 8218:8220 from trunk
Modified Paths:
--------------
branches/Version-1_0-branch/booking/inc/class.uibooking.inc.php
branches/Version-1_0-branch/booking/inc/class.uicompleted_reservation_export_file.inc.php
branches/Version-1_0-branch/booking/setup/phpgw_no.lang
branches/Version-1_0-branch/booking/templates/base/account_code_dimension.xsl
Added Paths:
-----------
branches/Version-1_0-branch/booking/inc/class.export_agresso.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
+
/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
Copied: branches/Version-1_0-branch/booking/inc/class.export_agresso.inc.php
(from rev 8219, trunk/booking/inc/class.export_agresso.inc.php)
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.export_agresso.inc.php
(rev 0)
+++ branches/Version-1_0-branch/booking/inc/class.export_agresso.inc.php
2011-11-30 12:37:18 UTC (rev 8221)
@@ -0,0 +1,144 @@
+<?php
+
+ /**
+ * Hvordan overføre filer til agresseo: ekempel fra 'property'
+ * Prosedyre: 1) Lag filnavn
+ * 2) Produser filen
+ * 3) Lagre filen lokalt (for
referanse/historikk/feilbehandling)
+ * 4) Overfør filen til Agresso
+ * 5) Evnt logg til databasen hvordan
dette gikk
+ *
+ * Forutsetning:1) configurasjon for lokal lagring (katalog)
+ * 2) configurasjon for pålogging til
ftp-server (IP/Login/Passord/envt katalog)
+ *
+ */
+
+ class export_agresso
+ {
+ function __construct()
+ {
+ $this->db =
&$GLOBALS['phpgw']->db;
+ $this->config =
CreateObject('phpgwapi.config','booking');
+ $this->config->read_repository();
+ }
+
+ public function do_your_magic($buffer,$id)
+ {
+ // Viktig: må kunne rulle tilbake dersom noe feiler.
+ $this->db->transaction_begin();
+
+// $buffer = 'test';
+
+ $filnavn = $this->lagfilnavn();
+
+ $file_written = false;
+
+ $fp = fopen($filnavn, "wb");
+ fwrite($fp,$buffer);
+
+ if(fclose($fp))
+ {
+ $file_written=true;
+ }
+
+ if($file_written &&
$this->config->config_data['invoice_export_method']!='ftp')
+ {
+ $transfer_ok = true;
+ }
+ else if($file_written)
+ {
+ $transfer_ok = $this->transfer($filnavn);
+ }
+
+ if($transfer_ok)
+ {
+ $this->db->transaction_commit();
+ $this->config->config_data['invoice_last_id'] =
$id;
+ $this->config->save_repository();
+ $message = "Godkjent: periode: {$Periode}
antall bilag/underbilag overfort: {$antall} , fil: {$filnavn}";
+ }
+ else
+ {
+ $this->db->transaction_abort();
+ $message = 'Noe gikk galt med overforing av
godkjendte fakturaer!';
+ }
+ return $message;
+ }
+
+
+ protected function lagfilnavn()
+ {
+ $fil_katalog =
$this->config->config_data['invoice_export_path'];
+ $continue = true;
+ $i = 1;
+ do
+ {
+ $filnavn = $fil_katalog . '/AktivbyLG04_' .
date("ymd") . '_' . sprintf("%02s",$i) . '.TXT';
+
+ //Sjekk om filen eksisterer
+ If (!file_exists($filnavn))
+ {
+ return $filnavn;
+ }
+
+ $i++;
+ }
+ while ($continue);
+
+ //Ingen løpenr er ledige, gi feilmelding
+ return false;
+ }
+
+ protected function transfer($filnavn)
+ {
+
+
if($this->config->config_data['invoice_export_method']=='ftp')
+ {
+
+ $transfer_ok = false;
+ $ftp = $this->phpftp_connect();
+ $basedir =
$this->config->config_data['invoice_ftp_basedir'];
+
+
+ if($basedir)
+ {
+ $newfile = $basedir . '/' .
basename($filnavn);
+ }
+ else
+ {
+ $newfile = basename($filnavn);
+ }
+
+ if (ftp_put($ftp, $newfile,$filnavn,
FTP_BINARY))
+ {
+ //log_transaction_ok
+ $transfer_ok = True;
+ }
+ else
+ {
+ //log_transaction_feil
+ $transfer_ok = false;
+ unlink($filnavn);
+ }
+ ftp_quit($ftp);
+ }
+ return $transfer_ok;
+ }
+
+ protected function phpftp_connect()
+ {
+ $host = $this->config->config_data['invoice_ftp_host'];
+ $user = $this->config->config_data['invoice_ftp_user'];
+ $pass =
$this->config->config_data['invoice_ftp_password'];
+
+ $ftp = ftp_connect($host);
+ if($ftp)
+ {
+ if ($lres = ftp_login($ftp,$user,$pass))
+ {
+ return $ftp;
+ }
+ }
+ }
+ }
+
Modified: branches/Version-1_0-branch/booking/inc/class.uibooking.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uibooking.inc.php
2011-11-30 12:34:17 UTC (rev 8220)
+++ branches/Version-1_0-branch/booking/inc/class.uibooking.inc.php
2011-11-30 12:37:18 UTC (rev 8221)
@@ -431,7 +431,11 @@
}
}
}
+ if($allocation['cost'] > 0) {
+ $errors['cost'] = lang('There is a cost of %1
assosiated with the allocation you are useing',$allocation['cost']);
+ }
$this->flash_form_errors($errors);
+ unset($errors['cost']);
self::add_javascript('booking', 'booking',
'booking.js');
array_set_default($booking, 'resources', array());
$booking['resources_json'] =
json_encode(array_map('intval', $booking['resources']));
Modified:
branches/Version-1_0-branch/booking/inc/class.uicompleted_reservation_export_file.inc.php
===================================================================
---
branches/Version-1_0-branch/booking/inc/class.uicompleted_reservation_export_file.inc.php
2011-11-30 12:34:17 UTC (rev 8220)
+++
branches/Version-1_0-branch/booking/inc/class.uicompleted_reservation_export_file.inc.php
2011-11-30 12:37:18 UTC (rev 8221)
@@ -9,6 +9,7 @@
'show' => true,
'add' => true,
'download' => true,
+ 'upload' => true,
);
protected
@@ -18,8 +19,10 @@
{
parent::__construct();
$this->bo =
CreateObject('booking.bocompleted_reservation_export_file');
+ $this->export_agresso =
CreateObject('booking.export_agresso');
self::set_active_menu('booking::invoice_center::generated_files');
$this->url_prefix =
'booking.uicompleted_reservation_export_file';
+
}
public function link_to($action, $params = array())
@@ -112,6 +115,12 @@
'sortable' => false,
),
array(
+ 'key' => 'upload',
+ 'label' =>
lang('Export'),
+ 'formatter' =>
'YAHOO.booking.formatGenericLink()',
+ 'sortable' => false,
+ ),
+ array(
'key' => 'link',
'hidden' => true
),
@@ -125,6 +134,9 @@
public function index_json()
{
$this->db = $GLOBALS['phpgw']->db;
+ $config = CreateObject('phpgwapi.config','booking');
+ $config->read();
+ 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) {
@@ -135,7 +147,18 @@
'label' => lang('Download'),
'href' => $this->link_to('download',
array('id' => $export_file['id']))
);
-
+ if ($export_file['total_items'] > 0 and
$export_file['id'] > $config->config_data['invoice_last_id'])
+ {
+ $export_file['upload'] = array(
+ 'label' => lang('Upload'),
+ 'href' =>
$this->link_to('upload', array('id' => $export_file['id']))
+ );
+ } else {
+ $export_file['upload'] = array(
+ 'label' => ' ',
+ 'href' => '#'
+ );
+ }
$sql = "SELECT account_lastname,
account_firstname FROM phpgw_accounts WHERE account_lid =
'".$export_file['created_by_name']."'";
$this->db->query($sql);
while ($record =
array_shift($this->db->resultSet)) {
@@ -166,4 +189,17 @@
$this->send_file($file->get_system_identifier(),
array('filename' => $file->get_identifier()));
}
+ public function upload() {
+ $id = phpgw::get_var('id', 'GET');
+ $export_file =
$this->bo->read_single(phpgw::get_var('id', 'GET'));
+
+ if (!is_array($export_file)) {
+ $this->redirect_to('index');
+ }
+
+ $file = $this->bo->get_file($export_file);
+ $content =
file_get_contents($file->get_system_identifier(),false);
+ $this->export_agresso->do_your_magic($content,$id);
+ $this->redirect_to('index');
+ }
}
Modified: branches/Version-1_0-branch/booking/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/booking/setup/phpgw_no.lang 2011-11-30
12:34:17 UTC (rev 8220)
+++ branches/Version-1_0-branch/booking/setup/phpgw_no.lang 2011-11-30
12:37:18 UTC (rev 8221)
@@ -537,3 +537,6 @@
All that borrow premises from Bergen Kommune must verify that they have read
the terms and conditions, this is usually fire regulations and house rules.
booking no Alle som leier lokaler hos Bergen kommune må bekrefte at de
har lest betingelsene, dette gjelder som regel brannforskrifter og husreglement.
Delete information booking no Hvis du kun skal slette tildeling på
valgt dato, velg Slett-knappen nederst og tiden blir vist som ledig i
kalenderen, og kan tildeles andre klubber/org.
Delete information2 booking no Skal du slette flere kan du velge Ut
sesong eller Slett til og velg en dato, du kan også velge intervall (f.eks.
annen hver uke).
+There is a cost of %1 assosiated with the allocation you are useing booking
no Det er en kostnad på %1kr knyttet til den tildelingen du bruker.
+Export booking no Eksport
+Upload booking no Last opp
Modified:
branches/Version-1_0-branch/booking/templates/base/account_code_dimension.xsl
===================================================================
---
branches/Version-1_0-branch/booking/templates/base/account_code_dimension.xsl
2011-11-30 12:34:17 UTC (rev 8220)
+++
branches/Version-1_0-branch/booking/templates/base/account_code_dimension.xsl
2011-11-30 12:37:18 UTC (rev 8221)
@@ -118,6 +118,72 @@
</select>
</dd>
</dl>
+
+ <div class="clr"/>
+
+ <dl class="form">
+ <dt class="heading"><xsl:value-of select="php:function('lang',
'Export aggresso')"/></dt>
+ </dl>
+
+ <p><xsl:value-of select="php:function('lang', 'export_help_text')"/></p>
+
+ <dl class="form-col">
+ <dt><label for="field_invoice_export_method"><xsl:value-of
select="php:function('lang', 'Export method')"/></label></dt>
+ <dd>
+ <select id="field_invoice_export_method"
name="invoice_export_method">
+ <option value="local">
+ <xsl:if
test="config_data/invoice_export_method='local'">
+ <xsl:attribute
name="selected">checked</xsl:attribute>
+ </xsl:if>
+ local
+ </option>
+ <option value="ftp">
+ <xsl:if test="config_data/invoice_export_method='ftp'">
+ <xsl:attribute
name="selected">checked</xsl:attribute>
+ </xsl:if>
+ ftp
+ </option>
+ </select>
+ </dd>
+ <dt><label for="field_invoice_export_path"><xsl:value-of
select="php:function('lang', 'Export path')"/></label></dt>
+ <dd>
+ <input id="field_invoice_export_path"
name="invoice_export_path" type="text">
+ <xsl:attribute
name="value"><xsl:value-of
select="config_data/invoice_export_path"/></xsl:attribute>
+ </input>
+ </dd>
+ <dt><label for="field_invoice_ftp_host"><xsl:value-of
select="php:function('lang', 'Ftp host')"/></label></dt>
+ <dd>
+ <input id="field_invoice_ftp_host"
name="invoice_ftp_host" type="text">
+ <xsl:attribute
name="value"><xsl:value-of
select="config_data/invoice_ftp_host"/></xsl:attribute>
+ </input>
+ </dd>
+ <dt><label for="field_invoice_ftp_basedir"><xsl:value-of
select="php:function('lang', 'Ftp basedir')"/></label></dt>
+ <dd>
+ <input id="field_invoice_ftp_basedir"
name="invoice_ftp_basedir" type="text">
+ <xsl:attribute
name="value"><xsl:value-of
select="config_data/invoice_ftp_basedir"/></xsl:attribute>
+ </input>
+ </dd>
+ <dt><label for="field_invoice_ftp_user"><xsl:value-of
select="php:function('lang', 'Ftp user')"/></label></dt>
+ <dd>
+ <input id="field_invoice_ftp_user"
name="invoice_ftp_user" type="text">
+ <xsl:attribute
name="value"><xsl:value-of
select="config_data/invoice_ftp_user"/></xsl:attribute>
+ </input>
+ </dd>
+ <dt><label for="field_invoice_ftp_password"><xsl:value-of
select="php:function('lang', 'Ftp password')"/></label></dt>
+ <dd>
+ <input id="field_invoice_ftp_password"
name="invoice_ftp_password" type="password">
+ <xsl:attribute
name="value"><xsl:value-of
select="config_data/invoice_ftp_password"/></xsl:attribute>
+ </input>
+ </dd>
+ <dt><label for="field_invoice_last_id"><xsl:value-of
select="php:function('lang', 'last id')"/></label></dt>
+ <p><xsl:value-of select="php:function('lang', 'Do not
edit!')"/></p>
+ <dd>
+ <input id="field_invoice_last_id"
name="invoice_last_id" type="text">
+ <xsl:attribute
name="value"><xsl:value-of
select="config_data/invoice_last_id"/></xsl:attribute>
+ </input>
+ </dd>
+ </dl>
+
<div class="form-buttons">
<input type="submit">
<xsl:attribute name="value"><xsl:value-of
select="php:function('lang', 'Save')"/></xsl:attribute>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8221] Merge 8218:8220 from trunk,
Sigurd Nes <=