diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql
index bf49e8730fb..dbff8454417 100644
--- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql
+++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql
@@ -37,6 +37,8 @@
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_stock_mouvement MODIFY batch VARCHAR(30) COLLATE utf8_unicode_ci;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_lot MODIFY batch VARCHAR(30) CHARACTER SET utf8;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_lot MODIFY batch VARCHAR(30) COLLATE utf8_unicode_ci;
+-- VMYSQLUTF8UNICODECI ALTER TABLE llx_expeditiondet_batch MODIFY batch VARCHAR(30) CHARACTER SET utf8;
+-- VMYSQLUTF8UNICODECI ALTER TABLE llx_expeditiondet_batch MODIFY batch VARCHAR(30) COLLATE utf8_unicode_ci;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_batch MODIFY batch VARCHAR(30) CHARACTER SET utf8;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_batch MODIFY batch VARCHAR(30) COLLATE utf8_unicode_ci;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_sell VARCHAR(32) CHARACTER SET utf8;
diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php
index 32d8aa1c2aa..b920c8d1a6a 100644
--- a/htdocs/loan/card.php
+++ b/htdocs/loan/card.php
@@ -27,8 +27,8 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/loan.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
-if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
+if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
@@ -124,42 +124,42 @@ if (empty($reshook))
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Rate")), null, 'errors');
}
- if (! $error)
- {
- $object->label = GETPOST('label');
- $object->fk_bank = GETPOST('accountid');
- $object->capital = $capital;
- $object->datestart = $datestart;
- $object->dateend = $dateend;
- $object->nbterm = GETPOST('nbterm');
- $object->rate = $rate;
- $object->note_private = GETPOST('note_private','none');
- $object->note_public = GETPOST('note_public','none');
- $object->fk_project = GETPOST('projectid','int');
+ if (! $error)
+ {
+ $object->label = GETPOST('label');
+ $object->fk_bank = GETPOST('accountid');
+ $object->capital = $capital;
+ $object->datestart = $datestart;
+ $object->dateend = $dateend;
+ $object->nbterm = GETPOST('nbterm');
+ $object->rate = $rate;
+ $object->note_private = GETPOST('note_private','none');
+ $object->note_public = GETPOST('note_public','none');
+ $object->fk_project = GETPOST('projectid','int');
- $accountancy_account_capital = GETPOST('accountancy_account_capital');
- $accountancy_account_insurance = GETPOST('accountancy_account_insurance');
- $accountancy_account_interest = GETPOST('accountancy_account_interest');
+ $accountancy_account_capital = GETPOST('accountancy_account_capital');
+ $accountancy_account_insurance = GETPOST('accountancy_account_insurance');
+ $accountancy_account_interest = GETPOST('accountancy_account_interest');
- if ($accountancy_account_capital <= 0) { $object->account_capital = ''; } else { $object->account_capital = $accountancy_account_capital; }
- if ($accountancy_account_insurance <= 0) { $object->account_insurance = ''; } else { $object->account_insurance = $accountancy_account_insurance; }
- if ($accountancy_account_interest <= 0) { $object->account_interest = ''; } else { $object->account_interest = $accountancy_account_interest; }
+ if ($accountancy_account_capital <= 0) { $object->account_capital = ''; } else { $object->account_capital = $accountancy_account_capital; }
+ if ($accountancy_account_insurance <= 0) { $object->account_insurance = ''; } else { $object->account_insurance = $accountancy_account_insurance; }
+ if ($accountancy_account_interest <= 0) { $object->account_interest = ''; } else { $object->account_interest = $accountancy_account_interest; }
- $id=$object->create($user);
- if ($id <= 0)
- {
- $error++;
- setEventMessages($object->error, $object->errors, 'errors');
- $action = 'create';
- }
- }
- }
- else
- {
- header("Location: index.php");
- exit();
- }
- }
+ $id=$object->create($user);
+ if ($id <= 0)
+ {
+ $error++;
+ setEventMessages($object->error, $object->errors, 'errors');
+ $action = 'create';
+ }
+ }
+ }
+ else
+ {
+ header("Location: index.php");
+ exit();
+ }
+ }
// Update record
else if ($action == 'update' && $user->rights->loan->write)
@@ -550,11 +550,13 @@ if ($id > 0)
print '';
// Accountancy account capital
- print '
| ';
- print $langs->trans("LoanAccountancyCapitalCode");
- print ' | ';
+ print ' |
';
if ($action == 'edit')
{
+ print '| ';
+ print $langs->trans("LoanAccountancyCapitalCode");
+ print ' | ';
+
if (! empty($conf->accounting->enabled))
{
print $formaccounting->select_account($object->account_capital, 'accountancy_account_capital', 1, '', 1, 1);
@@ -563,23 +565,36 @@ if ($id > 0)
{
print '';
}
+ print ' | ';
}
else
{
- if (! empty($conf->accounting->enabled)) {
- print length_accountg($object->account_capital);
+ print '';
+ print $langs->trans("LoanAccountancyCapitalCode");
+ print ' | ';
+
+ if (! empty($conf->accounting->enabled))
+ {
+ $accountingaccount = new AccountingAccount($db);
+ $accountingaccount->fetch('',$object->account_capital, 1);
+
+ print $accountingaccount->getNomUrl(0,1,1,'',1);
} else {
print $object->account_capital;
}
+
+ print ' | ';
}
- print '
';
+ print '';
// Accountancy account insurance
- print '| ';
- print $langs->trans("LoanAccountancyInsuranceCode");
- print ' | ';
+ print ' |
';
if ($action == 'edit')
{
+ print '| ';
+ print $langs->trans("LoanAccountancyInsuranceCode");
+ print ' | ';
+
if (! empty($conf->accounting->enabled))
{
print $formaccounting->select_account($object->account_insurance, 'accountancy_account_insurance', 1, '', 1, 1);
@@ -588,23 +603,36 @@ if ($id > 0)
{
print '';
}
+ print ' | ';
}
else
{
- if (! empty($conf->accounting->enabled)) {
- print length_accountg($object->account_insurance);
+ print '';
+ print $langs->trans("LoanAccountancyCapitalCode");
+ print ' | ';
+
+ if (! empty($conf->accounting->enabled))
+ {
+ $accountingaccount = new AccountingAccount($db);
+ $accountingaccount->fetch('',$object->account_insurance, 1);
+
+ print $accountingaccount->getNomUrl(0,1,1,'',1);
} else {
print $object->account_insurance;
}
+
+ print ' | ';
}
- print '
';
+ print '';
// Accountancy account interest
- print '| ';
- print $langs->trans("LoanAccountancyInterestCode");
- print ' | ';
+ print ' |
';
if ($action == 'edit')
{
+ print '| ';
+ print $langs->trans("LoanAccountancyInterestCode");
+ print ' | ';
+
if (! empty($conf->accounting->enabled))
{
print $formaccounting->select_account($object->account_interest, 'accountancy_account_interest', 1, '', 1, 1);
@@ -613,16 +641,27 @@ if ($id > 0)
{
print '';
}
+ print ' | ';
}
else
{
- if (! empty($conf->accounting->enabled)) {
- print length_accountg($object->account_interest);
+ print '';
+ print $langs->trans("LoanAccountancyInterestCode");
+ print ' | ';
+
+ if (! empty($conf->accounting->enabled))
+ {
+ $accountingaccount = new AccountingAccount($db);
+ $accountingaccount->fetch('',$object->account_interest, 1);
+
+ print $accountingaccount->getNomUrl(0,1,1,'',1);
} else {
print $object->account_interest;
}
+
+ print ' | ';
}
- print '
';
+ print '';
print '';
diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php
index 8464860be2f..19e8f5f84bf 100644
--- a/htdocs/loan/class/loan.class.php
+++ b/htdocs/loan/class/loan.class.php
@@ -297,6 +297,9 @@ class Loan extends CommonObject
$sql.= " capital='".price2num($this->db->escape($this->capital))."',";
$sql.= " datestart='".$this->db->idate($this->datestart)."',";
$sql.= " dateend='".$this->db->idate($this->dateend)."',";
+ $sql.= " accountancy_account_capital = '".$this->db->escape($this->account_capital)."',";
+ $sql.= " accountancy_account_insurance = '".$this->db->escape($this->account_insurance)."',";
+ $sql.= " accountancy_account_interest = '".$this->db->escape($this->account_interest)."',";
$sql.= " fk_projet=".(empty($this->fk_project)?'NULL':$this->fk_project).",";
$sql.= " fk_user_modif = ".$user->id;
$sql.= " WHERE rowid=".$this->id;
diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php
index d5215ef8106..81e28663cc4 100644
--- a/htdocs/projet/class/api_tasks.class.php
+++ b/htdocs/projet/class/api_tasks.class.php
@@ -275,7 +275,7 @@ class Tasks extends DolibarrApi
throw new RestException(404, 'Task not found');
}
- if( ! DolibarrApi::_checkAccessToResource('task',$this->task->id)) {
+ if( ! DolibarrApi::_checkAccessToResource('tasks',$this->task->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@@ -432,7 +432,7 @@ class Tasks extends DolibarrApi
throw new RestException(404, 'Task not found');
}
- if( ! DolibarrApi::_checkAccessToResource('task',$this->project->id)) {
+ if( ! DolibarrApi::_checkAccessToResource('tasks',$this->project->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
foreach($request_data as $field => $value) {
@@ -467,7 +467,7 @@ class Tasks extends DolibarrApi
throw new RestException(404, 'Task not found');
}
- if( ! DolibarrApi::_checkAccessToResource('task',$this->project->id)) {
+ if( ! DolibarrApi::_checkAccessToResource('tasks',$this->project->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}