FIX : Various payment
This commit is contained in:
parent
dbd96d1ac7
commit
7b935a96bf
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/class/accountingaccount.class.php
|
* \file htdocs/accountancy/class/accountingaccount.class.php
|
||||||
* \ingroup Advanced accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief File of class to manage accounting accounts
|
* \brief File of class to manage accounting accounts
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -152,11 +152,11 @@ class AccountingAccount extends CommonObject
|
|||||||
|
|
||||||
if (empty($this->pcg_type) || $this->pcg_type == '-1')
|
if (empty($this->pcg_type) || $this->pcg_type == '-1')
|
||||||
{
|
{
|
||||||
$this->pcg_type = 'XXXXXX';
|
$this->pcg_type = 'XXXXXX';
|
||||||
}
|
}
|
||||||
if (empty($this->pcg_subtype) || $this->pcg_subtype == '-1')
|
if (empty($this->pcg_subtype) || $this->pcg_subtype == '-1')
|
||||||
{
|
{
|
||||||
$this->pcg_subtype = 'XXXXXX';
|
$this->pcg_subtype = 'XXXXXX';
|
||||||
}
|
}
|
||||||
// Check parameters
|
// Check parameters
|
||||||
// Put here code to add control on parameters values
|
// Put here code to add control on parameters values
|
||||||
@ -235,17 +235,17 @@ class AccountingAccount extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function update($user)
|
function update($user)
|
||||||
{
|
{
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (empty($this->pcg_type) || $this->pcg_type == '-1')
|
if (empty($this->pcg_type) || $this->pcg_type == '-1')
|
||||||
{
|
{
|
||||||
$this->pcg_type = 'XXXXXX';
|
$this->pcg_type = 'XXXXXX';
|
||||||
}
|
}
|
||||||
if (empty($this->pcg_subtype) || $this->pcg_subtype == '-1')
|
if (empty($this->pcg_subtype) || $this->pcg_subtype == '-1')
|
||||||
{
|
{
|
||||||
$this->pcg_subtype = 'XXXXXX';
|
$this->pcg_subtype = 'XXXXXX';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";
|
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";
|
||||||
$sql .= " SET fk_pcg_version = " . ($this->fk_pcg_version ? "'" . $this->db->escape($this->fk_pcg_version) . "'" : "null");
|
$sql .= " SET fk_pcg_version = " . ($this->fk_pcg_version ? "'" . $this->db->escape($this->fk_pcg_version) . "'" : "null");
|
||||||
@ -395,17 +395,17 @@ class AccountingAccount extends CommonObject
|
|||||||
$linkclose='';
|
$linkclose='';
|
||||||
if (empty($notooltip))
|
if (empty($notooltip))
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||||
{
|
{
|
||||||
$label=$langs->trans("ShowAccoutingAccount");
|
$label=$langs->trans("ShowAccoutingAccount");
|
||||||
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||||
}
|
}
|
||||||
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||||
$linkclose.=' class="classfortooltip"';
|
$linkclose.=' class="classfortooltip"';
|
||||||
}
|
}
|
||||||
|
|
||||||
$linkstart='<a href="'.$url.'"';
|
$linkstart='<a href="'.$url.'"';
|
||||||
$linkstart.=$linkclose.'>';
|
$linkstart.=$linkclose.'>';
|
||||||
$linkend='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
if ($nourl)
|
if ($nourl)
|
||||||
@ -462,10 +462,10 @@ class AccountingAccount extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Account desactivate
|
* Account deactivated
|
||||||
*
|
*
|
||||||
* @param int $id Id
|
* @param int $id Id
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function account_desactivate($id) {
|
function account_desactivate($id) {
|
||||||
$result = $this->checkUsage();
|
$result = $this->checkUsage();
|
||||||
@ -494,10 +494,10 @@ class AccountingAccount extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Account activate
|
* Account activated
|
||||||
*
|
*
|
||||||
* @param int $id Id
|
* @param int $id Id
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function account_activate($id) {
|
function account_activate($id) {
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
@ -522,56 +522,56 @@ class AccountingAccount extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Retourne le libelle du statut d'un user (actif, inactif)
|
* Retourne le libelle du statut d'un user (actif, inactif)
|
||||||
*
|
*
|
||||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||||
* @return string Label of status
|
* @return string Label of status
|
||||||
*/
|
*/
|
||||||
function getLibStatut($mode=0)
|
function getLibStatut($mode=0)
|
||||||
{
|
{
|
||||||
return $this->LibStatut($this->status,$mode);
|
return $this->LibStatut($this->status,$mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renvoi le libelle d'un statut donne
|
* Renvoi le libelle d'un statut donne
|
||||||
*
|
*
|
||||||
* @param int $statut Id statut
|
* @param int $statut Id statut
|
||||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||||
* @return string Label of status
|
* @return string Label of status
|
||||||
*/
|
*/
|
||||||
function LibStatut($statut,$mode=0)
|
function LibStatut($statut,$mode=0)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
$langs->load('users');
|
$langs->load('users');
|
||||||
|
|
||||||
if ($mode == 0)
|
if ($mode == 0)
|
||||||
{
|
{
|
||||||
$prefix='';
|
$prefix='';
|
||||||
if ($statut == 1) return $langs->trans('Enabled');
|
if ($statut == 1) return $langs->trans('Enabled');
|
||||||
if ($statut == 0) return $langs->trans('Disabled');
|
if ($statut == 0) return $langs->trans('Disabled');
|
||||||
}
|
}
|
||||||
if ($mode == 1)
|
if ($mode == 1)
|
||||||
{
|
{
|
||||||
if ($statut == 1) return $langs->trans('Enabled');
|
if ($statut == 1) return $langs->trans('Enabled');
|
||||||
if ($statut == 0) return $langs->trans('Disabled');
|
if ($statut == 0) return $langs->trans('Disabled');
|
||||||
}
|
}
|
||||||
if ($mode == 2)
|
if ($mode == 2)
|
||||||
{
|
{
|
||||||
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
||||||
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
||||||
}
|
}
|
||||||
if ($mode == 3)
|
if ($mode == 3)
|
||||||
{
|
{
|
||||||
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4');
|
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4');
|
||||||
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5');
|
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5');
|
||||||
}
|
}
|
||||||
if ($mode == 4)
|
if ($mode == 4)
|
||||||
{
|
{
|
||||||
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
||||||
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
||||||
}
|
}
|
||||||
if ($mode == 5)
|
if ($mode == 5)
|
||||||
{
|
{
|
||||||
if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
|
if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
|
||||||
if ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
|
if ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -618,8 +618,8 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$MAXNBERRORS=5;
|
$MAXNBERRORS=5;
|
||||||
if ($error >= $MAXNBERRORS)
|
if ($error >= $MAXNBERRORS)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped").' (>'.$MAXNBERRORS.')', null, 'errors');
|
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped").' (>'.$MAXNBERRORS.')', null, 'errors');
|
||||||
break; // Break in the foreach
|
break; // Break in the foreach
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1059,59 +1059,59 @@ function getSourceDocRef($val, $typerecord)
|
|||||||
$sqlmid = 'SELECT payfac.fk_facture as id, f.facnumber as ref';
|
$sqlmid = 'SELECT payfac.fk_facture as id, f.facnumber as ref';
|
||||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f";
|
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f";
|
||||||
$sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=" . $val["paymentid"];
|
$sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=" . $val["paymentid"];
|
||||||
$ref = $langs->trans("Invoice");
|
$ref = $langs->trans("Invoice");
|
||||||
}
|
}
|
||||||
elseif ($typerecord == 'payment_supplier')
|
elseif ($typerecord == 'payment_supplier')
|
||||||
{
|
{
|
||||||
$sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref';
|
$sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfac, ".MAIN_DB_PREFIX."facture_fourn as f";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfac, ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||||
$sqlmid .= " WHERE payfac.fk_facturefourn = f.rowid AND payfac.fk_paiementfourn=" . $val["paymentsupplierid"];
|
$sqlmid .= " WHERE payfac.fk_facturefourn = f.rowid AND payfac.fk_paiementfourn=" . $val["paymentsupplierid"];
|
||||||
$ref = $langs->trans("SupplierInvoice");
|
$ref = $langs->trans("SupplierInvoice");
|
||||||
}
|
}
|
||||||
elseif ($typerecord == 'payment_expensereport')
|
elseif ($typerecord == 'payment_expensereport')
|
||||||
{
|
{
|
||||||
$sqlmid = 'SELECT e.rowid as id, e.ref';
|
$sqlmid = 'SELECT e.rowid as id, e.ref';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_expensereport as pe, " . MAIN_DB_PREFIX . "expensereport as e";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_expensereport as pe, " . MAIN_DB_PREFIX . "expensereport as e";
|
||||||
$sqlmid .= " WHERE pe.rowid=" . $val["paymentexpensereport"]." AND pe.fk_expensereport = e.rowid";
|
$sqlmid .= " WHERE pe.rowid=" . $val["paymentexpensereport"]." AND pe.fk_expensereport = e.rowid";
|
||||||
$ref = $langs->trans("ExpenseReport");
|
$ref = $langs->trans("ExpenseReport");
|
||||||
}
|
}
|
||||||
elseif ($typerecord == 'payment_salary')
|
elseif ($typerecord == 'payment_salary')
|
||||||
{
|
{
|
||||||
$sqlmid = 'SELECT s.rowid as ref';
|
$sqlmid = 'SELECT s.rowid as ref';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_salary as s";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_salary as s";
|
||||||
$sqlmid .= " WHERE s.rowid=" . $val["paymentsalid"];
|
$sqlmid .= " WHERE s.rowid=" . $val["paymentsalid"];
|
||||||
$ref = $langs->trans("SalaryPayment");
|
$ref = $langs->trans("SalaryPayment");
|
||||||
}
|
}
|
||||||
elseif ($typerecord == 'payment_vat')
|
elseif ($typerecord == 'payment_vat')
|
||||||
{
|
{
|
||||||
$sqlmid = 'SELECT v.rowid as ref';
|
$sqlmid = 'SELECT v.rowid as ref';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "tva as v";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "tva as v";
|
||||||
$sqlmid .= " WHERE v.rowid=" . $val["paymentvatid"];
|
$sqlmid .= " WHERE v.rowid=" . $val["paymentvatid"];
|
||||||
$ref = $langs->trans("PaymentVat");
|
$ref = $langs->trans("PaymentVat");
|
||||||
}
|
}
|
||||||
elseif ($typerecord == 'payment_donation')
|
elseif ($typerecord == 'payment_donation')
|
||||||
{
|
{
|
||||||
$sqlmid = 'SELECT payd.fk_donation as ref';
|
$sqlmid = 'SELECT payd.fk_donation as ref';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_donation as payd";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_donation as payd";
|
||||||
$sqlmid .= " WHERE payd.fk_donation=" . $val["paymentdonationid"];
|
$sqlmid .= " WHERE payd.fk_donation=" . $val["paymentdonationid"];
|
||||||
$ref = $langs->trans("Donation").' ';
|
$ref = $langs->trans("Donation").' ';
|
||||||
}
|
}
|
||||||
elseif ($typerecord == 'payment_various')
|
elseif ($typerecord == 'payment_various')
|
||||||
{
|
{
|
||||||
$sqlmid = 'SELECT v.rowid as ref';
|
$sqlmid = 'SELECT v.rowid as ref';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_various as v";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_various as v";
|
||||||
$sqlmid .= " WHERE v.rowid=" . $val["paymentvariousid"];
|
$sqlmid .= " WHERE v.rowid=" . $val["paymentvariousid"];
|
||||||
$ref = $langs->trans("VariousPayment");
|
$ref = $langs->trans("VariousPayment");
|
||||||
}
|
}
|
||||||
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
||||||
$resultmid = $db->query($sqlmid);
|
$resultmid = $db->query($sqlmid);
|
||||||
if ($resultmid) {
|
if ($resultmid) {
|
||||||
while ($objmid = $db->fetch_object($resultmid))
|
while ($objmid = $db->fetch_object($resultmid))
|
||||||
{
|
{
|
||||||
$ref.=' '.$objmid->ref;
|
$ref.=' '.$objmid->ref;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else dol_print_error($db);
|
else dol_print_error($db);
|
||||||
|
|
||||||
return $ref;
|
return $ref;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -437,7 +437,7 @@ if ($id)
|
|||||||
if (! empty($conf->accounting->enabled))
|
if (! empty($conf->accounting->enabled))
|
||||||
{
|
{
|
||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
$accountingaccount->fetch('',$object->accountancy_code);
|
$accountingaccount->fetch('',$object->accountancy_code, 1);
|
||||||
|
|
||||||
print $accountingaccount->getNomUrl(0,1,1,'',1);
|
print $accountingaccount->getNomUrl(0,1,1,'',1);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
/* Copyright (C) 2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -257,7 +257,7 @@ if ($result)
|
|||||||
// Accounting account
|
// Accounting account
|
||||||
if (! empty($conf->accounting->enabled)) {
|
if (! empty($conf->accounting->enabled)) {
|
||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
$accountingaccount->fetch('',$obj->accountancy_code);
|
$accountingaccount->fetch('', $obj->accountancy_code, 1);
|
||||||
|
|
||||||
print '<td>'.$accountingaccount->getNomUrl(0,1,1,'',1).'</td>';
|
print '<td>'.$accountingaccount->getNomUrl(0,1,1,'',1).'</td>';
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user