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) if ($table_element == 'projet_task') return ''; // Special cas of element we never link to a project (already always done)
$linkedtothirdparty=false; $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=''; $sqlfilter='';
$projectkey="fk_projet"; $projectkey="fk_projet";
//print $table_element; //print $table_element;
switch ($table_element) switch ($table_element)
{ {
case "loan":
$sql = "SELECT t.rowid, t.label as ref";
break;
case "facture": case "facture":
$sql = "SELECT t.rowid, t.facnumber as ref"; $sql = "SELECT t.rowid, t.facnumber as ref";
break; 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 GoToInterest=%s will go towards INTEREST
GoToPrincipal=%s will go towards PRINCIPAL GoToPrincipal=%s will go towards PRINCIPAL
YouWillSpend=You will spend %s in year %s YouWillSpend=You will spend %s in year %s
ListLoanAssociatedProject=List of loan associated with the project
# Admin # Admin
ConfigLoan=Configuration of the module loan ConfigLoan=Configuration of the module loan
LOAN_ACCOUNTING_ACCOUNT_CAPITAL=Accounting account capital by default 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'; require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
/** \class Loan /**
* \brief Class to manage loan * Loan
*/ */
class Loan extends CommonObject class Loan extends CommonObject
{ {
@ -404,7 +404,7 @@ class Loan extends CommonObject
* @param int $maxlen Label max length * @param int $maxlen Label max length
* @return string Chaine with URL * @return string Chaine with URL
*/ */
function getLinkUrl($withpicto=0,$maxlen=0) function getNomUrl($withpicto=0,$maxlen=0)
{ {
global $langs; global $langs;

View File

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

View File

@ -231,7 +231,7 @@ if ($resql)
// Ref // Ref
print '<td>'; print '<td>';
$loan->fetch($objp->id); $loan->fetch($objp->id);
print $loan->getLinkUrl(1); print $loan->getNomUrl(1);
print "</td>\n"; print "</td>\n";
// Label // Label
print '<td>'.$objp->label.'</td>'; 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->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->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->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("projects");
$langs->load("companies"); $langs->load("companies");
@ -377,14 +377,14 @@ $listofreferent=array(
'title'=>"ListLoanAssociatedProject", 'title'=>"ListLoanAssociatedProject",
'class'=>'Loan', 'class'=>'Loan',
'margin'=>'add', 'margin'=>'add',
'table'=>'Loan', 'table'=>'loan',
'datefieldname'=>'datestart', 'datefieldname'=>'datestart',
'disableamount'=>0, 'disableamount'=>0,
'urlnew'=>DOL_URL_ROOT.'/loan/card.php?action=create&projectid='.$id.'&socid='.$socid, 'urlnew'=>DOL_URL_ROOT.'/loan/card.php?action=create&projectid='.$id.'&socid='.$socid,
'lang'=>'loan', 'lang'=>'loan',
'buttonnew'=>'AddLoan', 'buttonnew'=>'AddLoan',
'testnew'=>$user->rights->loan->creer, 'testnew'=>$user->rights->loan->write,
'test'=>$conf->loan->enabled && $user->rights->loan->lire), 'test'=>$conf->loan->enabled && $user->rights->loan->read),
'project_task'=>array( 'project_task'=>array(
'name'=>"TaskTimeValorised", 'name'=>"TaskTimeValorised",
'title'=>"ListTaskTimeUserProject", 'title'=>"ListTaskTimeUserProject",