[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8577] property: add manual invoice
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [8577] property: add manual invoice |
Date: |
Sun, 15 Jan 2012 20:23:55 +0000 |
Revision: 8577
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8577
Author: sigurdne
Date: 2012-01-15 20:23:54 +0000 (Sun, 15 Jan 2012)
Log Message:
-----------
property: add manual invoice
Modified Paths:
--------------
trunk/property/inc/class.boinvoice.inc.php
trunk/property/inc/class.soXport.inc.php
trunk/property/inc/class.uiworkorder.inc.php
trunk/property/setup/phpgw_no.lang
Modified: trunk/property/inc/class.boinvoice.inc.php
===================================================================
--- trunk/property/inc/class.boinvoice.inc.php 2012-01-15 16:29:14 UTC (rev
8576)
+++ trunk/property/inc/class.boinvoice.inc.php 2012-01-15 20:23:54 UTC (rev
8577)
@@ -355,6 +355,9 @@
public function add_manual_invoice($values)
{
+ $receipt = array();
+ $config =
CreateObject('admin.soconfig',$GLOBALS['phpgw']->locations->get_id('property',
'.invoice'));
+
$buffer = array();
$soXport = CreateObject('property.soXport');
if($values['loc1']=$values['location']['loc1'])
@@ -376,9 +379,32 @@
$values['kildeid'] = 1;
$values['pmwrkord_code'] = $values['order_id'];
-
- $values['bilagsnr'] =
execMethod('property.socommon.increment_id','Bilagsnummer');
- $values['bilagsnr_ut'] =
$values['voucher_out_id'];
+
+
if(isset($config->config_data['common']['manual_voucher_id']) &&
$config->config_data['common']['manual_voucher_id'])
+ {
+ if(
$soXport->check_voucher_id($values['voucher_out_id']))
+ {
+ $receipt['error'][] =
array('msg'=>lang('voucher id already taken'));
+ }
+ $values['bilagsnr'] =
$values['voucher_out_id'];
+ $values['bilagsnr_ut'] = '';
+ }
+ else
+ {
+ $values['bilagsnr'] =
execMethod('property.socommon.increment_id','Bilagsnummer');
+ $values['bilagsnr_ut'] =
$values['voucher_out_id'];
+ }
+
+ if( $soXport->check_invoice_id($values['vendor_id'],
$values['invoice_id']))
+ {
+ $receipt['error'][] =
array('msg'=>lang('invoice id already taken for this vendor'));
+ }
+
+ if(isset($receipt['error']))
+ {
+ return $receipt;
+ }
+
$values['kostra_id'] =
$soXport->get_kostra_id($values['loc1']);
$values['mvakode'] =
(int)$values['tax_code'];
$values['project_id'] =
$values['project_group'];
Modified: trunk/property/inc/class.soXport.inc.php
===================================================================
--- trunk/property/inc/class.soXport.inc.php 2012-01-15 16:29:14 UTC (rev
8576)
+++ trunk/property/inc/class.soXport.inc.php 2012-01-15 20:23:54 UTC (rev
8577)
@@ -751,4 +751,49 @@
$this->db->query($sql,__LINE__,__FILE__);
}
+ public function check_voucher_id($voucher_id)
+ {
+ $found = 0;
+ $sql = "SELECT bilagsnr FROM fm_ecobilag WHERE
bilagsnr='{$voucher_id}'";
+ $this->db->query($sql,__LINE__,__FILE__);
+
+ if($this->db->next_record())
+ {
+ $found++;
+ }
+
+ $sql = "SELECT bilagsnr FROM fm_ecobilagoverf WHERE
bilagsnr='{$voucher_id}'";
+ $this->db->query($sql,__LINE__,__FILE__);
+
+ if($this->db->next_record())
+ {
+ $found++;
+ }
+ return $found;
+ }
+
+ public function check_invoice_id($vendor_id, $invoice_id)
+ {
+ $found = 0;
+
+ $values['fakturanr'] = $values['invoice_id'];
+ $values['spvend_code'] = $values['vendor_id'];
+
+ $sql = "SELECT bilagsnr FROM fm_ecobilag WHERE
spvend_code= '{$vendor_id}' AND fakturanr='{$invoice_id}'";
+ $this->db->query($sql,__LINE__,__FILE__);
+
+ if($this->db->next_record())
+ {
+ $found++;
+ }
+
+ $sql = "SELECT bilagsnr FROM fm_ecobilagoverf WHERE
spvend_code= '{$vendor_id}' AND fakturanr='{$invoice_id}'";
+ $this->db->query($sql,__LINE__,__FILE__);
+
+ if($this->db->next_record())
+ {
+ $found++;
+ }
+ return $found;
+ }
}
Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php 2012-01-15 16:29:14 UTC
(rev 8576)
+++ trunk/property/inc/class.uiworkorder.inc.php 2012-01-15 20:23:54 UTC
(rev 8577)
@@ -2014,13 +2014,8 @@
$_receipt = array();//local errors
$receipt =
$boinvoice->add_manual_invoice($values);
- if(!$receipt['message'] &&
$values['order_id'] && !$receipt[0]['spvend_code'])
+ if(!$receipt['error']) // all ok
{
- $_receipt['error'][] =
array('msg'=>lang('vendor is not defined in order %1', $values['order_id']));
- }
-
- if(!$_receipt['error']) // all ok
- {
$redirect = true;
}
}
Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang 2012-01-15 16:29:14 UTC (rev 8576)
+++ trunk/property/setup/phpgw_no.lang 2012-01-15 20:23:54 UTC (rev 8577)
@@ -896,6 +896,7 @@
invoice address property no Fakturaadresse
invoice date property no Fakturadato
invoice id property no Faktura ID
+invoice id already taken for this vendor property no
Fakturanummeret er allerede registrert for denne leverandøren
invoice is not added! property no Fakturaen er IKKE lagt til!
invoice number property no FakturaNr
invoice tranferred property no bilag er overført
@@ -1844,6 +1845,7 @@
voucher property no Bilag
voucher date property no BilagsDato
voucher id property no BilagsNr
+voucher id already taken property no BilagsNr er allerede
brukt
voucher is updated property no Bilag er oppdatert
voucher is updated: property no Bilag er oppdatert:
voucher period is updated property no bilags periode er
oppdatert
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8577] property: add manual invoice,
Sigurd Nes <=