Fix project on loans

This commit is contained in:
Laurent Destailleur 2017-01-07 17:54:47 +01:00
parent d23aa8ef3c
commit 4c4aeba855
6 changed files with 14 additions and 10 deletions

View File

@ -458,13 +458,16 @@ class FormProjets
if ($table_element == 'projet_task') return ''; // Special cas of element we never link to a project (already always done)
$linkedtothirdparty=false;
if (! in_array($table_element, array('don','expensereport_det','expensereport'))) $linkedtothirdparty=true;
if (! in_array($table_element, array('don','expensereport_det','expensereport','loan'))) $linkedtothirdparty=true;
$sqlfilter='';
$projectkey="fk_projet";
//print $table_element;
switch ($table_element)
{
case "loan":
$sql = "SELECT t.rowid, t.label as ref";
break;
case "facture":
$sql = "SELECT t.rowid, t.facnumber as ref";
break;

View File

@ -43,6 +43,7 @@ LoanCalcDesc=This <b>mortgage calculator</b> can be used to figure out monthly p
GoToInterest=%s will go towards INTEREST
GoToPrincipal=%s will go towards PRINCIPAL
YouWillSpend=You will spend %s in year %s
ListLoanAssociatedProject=List of loan associated with the project
# Admin
ConfigLoan=Configuration of the module loan
LOAN_ACCOUNTING_ACCOUNT_CAPITAL=Accounting account capital by default

View File

@ -24,8 +24,8 @@
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
/** \class Loan
* \brief Class to manage loan
/**
* Loan
*/
class Loan extends CommonObject
{
@ -404,7 +404,7 @@ class Loan extends CommonObject
* @param int $maxlen Label max length
* @return string Chaine with URL
*/
function getLinkUrl($withpicto=0,$maxlen=0)
function getNomUrl($withpicto=0,$maxlen=0)
{
global $langs;

View File

@ -157,7 +157,7 @@ if ($resql)
print "<tr ".$bc[$var].">";
// Ref
print '<td>'.$loan_static->getLinkUrl(1, 42).'</td>';
print '<td>'.$loan_static->getNomUrl(1, 42).'</td>';
// Label
print '<td>'.dol_trunc($obj->label,42).'</td>';

View File

@ -231,7 +231,7 @@ if ($resql)
// Ref
print '<td>';
$loan->fetch($objp->id);
print $loan->getLinkUrl(1);
print $loan->getNomUrl(1);
print "</td>\n";
// Label
print '<td>'.$objp->label.'</td>';

View File

@ -47,7 +47,7 @@ if (! empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compt
if (! empty($conf->expensereport->enabled)) require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
if (! empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
if (! empty($conf->don->enabled)) require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
if (! empty($conf->loan->enabled)) require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
if (! empty($conf->loan->enabled)) require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
$langs->load("projects");
$langs->load("companies");
@ -377,14 +377,14 @@ $listofreferent=array(
'title'=>"ListLoanAssociatedProject",
'class'=>'Loan',
'margin'=>'add',
'table'=>'Loan',
'table'=>'loan',
'datefieldname'=>'datestart',
'disableamount'=>0,
'urlnew'=>DOL_URL_ROOT.'/loan/card.php?action=create&projectid='.$id.'&socid='.$socid,
'lang'=>'loan',
'buttonnew'=>'AddLoan',
'testnew'=>$user->rights->loan->creer,
'test'=>$conf->loan->enabled && $user->rights->loan->lire),
'testnew'=>$user->rights->loan->write,
'test'=>$conf->loan->enabled && $user->rights->loan->read),
'project_task'=>array(
'name'=>"TaskTimeValorised",
'title'=>"ListTaskTimeUserProject",