Various fix on Loan and project link
This commit is contained in:
parent
f97bab6fb8
commit
a251f0df51
@ -223,4 +223,4 @@ ALTER TABLE llx_links ADD UNIQUE INDEX uk_links (objectid,label);
|
||||
|
||||
ALTER TABLE llx_c_actioncomm MODIFY COLUMN type varchar(50) DEFAULT 'system' NOT NULL;
|
||||
|
||||
ALTER TABLE llx_loan ADD COLUMN fk_project integer DEFAULT NULL;
|
||||
ALTER TABLE llx_loan ADD COLUMN fk_projet integer DEFAULT NULL;
|
||||
|
||||
@ -48,5 +48,5 @@ create table llx_loan
|
||||
fk_user_author integer DEFAULT NULL,
|
||||
fk_user_modif integer DEFAULT NULL,
|
||||
active tinyint DEFAULT 1 NOT NULL,
|
||||
fk_project integer DEFAULT NULL
|
||||
fk_projet integer DEFAULT NULL
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -127,7 +127,7 @@ if (empty($reshook))
|
||||
$object->rate = $_POST["rate"];
|
||||
$object->note_private = GETPOST('note_private');
|
||||
$object->note_public = GETPOST('note_public');
|
||||
$object->fk_project = GETPOST('fk_project');
|
||||
$object->fk_projet = GETPOST('fk_projet');
|
||||
|
||||
$accountancy_account_capital = GETPOST('accountancy_account_capital');
|
||||
$accountancy_account_insurance = GETPOST('accountancy_account_insurance');
|
||||
@ -165,7 +165,7 @@ if (empty($reshook))
|
||||
$object->dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int'));
|
||||
$object->nbterm = GETPOST("nbterm");
|
||||
$object->rate = GETPOST("rate");
|
||||
$object->fk_project = GETPOST("fk_project");
|
||||
$object->fk_projet = GETPOST("fk_projet");
|
||||
}
|
||||
|
||||
$result = $object->update($user);
|
||||
@ -264,7 +264,7 @@ if ($action == 'create')
|
||||
|
||||
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
||||
|
||||
$numproject=$formproject->select_projects(-1,GETPOST("fk_project"),'fk_project',16,0,1,1);
|
||||
$numproject=$formproject->select_projects(-1,GETPOST("fk_projet"),'fk_projet',16,0,1,1);
|
||||
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -473,11 +473,11 @@ if ($id > 0)
|
||||
print '</td><td>';
|
||||
if ($action == 'edit') {
|
||||
$formproject=new FormProjets($db);
|
||||
$numproject=$formproject->select_projects(-1,$object->fk_project,'fk_project',16,0,1,1);
|
||||
$numproject=$formproject->select_projects(-1,$object->fk_projet,'fk_projet',16,0,1,1);
|
||||
|
||||
} else {
|
||||
$project=new Project($db);
|
||||
$project->fetch($object->fk_project);
|
||||
$project->fetch($object->fk_projet);
|
||||
print $project->getNomUrl(1,'',1);;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
@ -50,7 +50,7 @@ class Loan extends CommonObject
|
||||
var $fk_bank;
|
||||
var $fk_user_creat;
|
||||
var $fk_user_modif;
|
||||
var $fk_project;
|
||||
var $fk_projet;
|
||||
|
||||
|
||||
/**
|
||||
@ -73,7 +73,7 @@ class Loan extends CommonObject
|
||||
function fetch($id)
|
||||
{
|
||||
$sql = "SELECT l.rowid, l.label, l.capital, l.datestart, l.dateend, l.nbterm, l.rate, l.note_private, l.note_public,";
|
||||
$sql.= " l.paid, l.accountancy_account_capital, l.accountancy_account_insurance, l.accountancy_account_interest,l.fk_project";
|
||||
$sql.= " l.paid, l.accountancy_account_capital, l.accountancy_account_insurance, l.accountancy_account_interest,l.fk_projet";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."loan as l";
|
||||
$sql.= " WHERE l.rowid = ".$id;
|
||||
|
||||
@ -100,7 +100,7 @@ class Loan extends CommonObject
|
||||
$this->account_capital = $obj->accountancy_account_capital;
|
||||
$this->account_insurance = $obj->accountancy_account_insurance;
|
||||
$this->account_interest = $obj->accountancy_account_interest;
|
||||
$this->fk_project = $obj->fk_project;
|
||||
$this->fk_projet = $obj->fk_projet;
|
||||
|
||||
$this->db->free($resql);
|
||||
return 1;
|
||||
@ -143,7 +143,7 @@ class Loan extends CommonObject
|
||||
if (isset($this->fk_bank)) $this->fk_bank=trim($this->fk_bank);
|
||||
if (isset($this->fk_user_creat)) $this->fk_user_creat=trim($this->fk_user_creat);
|
||||
if (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif);
|
||||
if (isset($this->fk_project)) $this->fk_project=trim($this->fk_project);
|
||||
if (isset($this->fk_projet)) $this->fk_projet=trim($this->fk_projet);
|
||||
|
||||
// Check parameters
|
||||
if (! $newcapital > 0 || empty($this->datestart) || empty($this->dateend))
|
||||
@ -161,7 +161,7 @@ class Loan extends CommonObject
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."loan (label, fk_bank, capital, datestart, dateend, nbterm, rate, note_private, note_public";
|
||||
$sql.= " ,accountancy_account_capital, accountancy_account_insurance, accountancy_account_interest, entity";
|
||||
$sql.= " ,datec,fk_project,fk_user_author)";
|
||||
$sql.= " ,datec,fk_projet,fk_user_author)";
|
||||
$sql.= " VALUES ('".$this->db->escape($this->label)."',";
|
||||
$sql.= " '".$this->db->escape($this->fk_bank)."',";
|
||||
$sql.= " '".price2num($newcapital)."',";
|
||||
@ -176,7 +176,7 @@ class Loan extends CommonObject
|
||||
$sql.= " '".$this->db->escape($this->account_interest)."',";
|
||||
$sql.= " ".$conf->entity.",";
|
||||
$sql.= " '".$this->db->idate($now)."',";
|
||||
$sql.= " '".$this->fk_project."',";
|
||||
$sql.= " ".(empty($this->fk_projet)?'NULL':$this->fk_projet).",";
|
||||
$sql.= " ".$user->id;
|
||||
$sql.= ")";
|
||||
|
||||
@ -284,7 +284,7 @@ class Loan extends CommonObject
|
||||
$sql.= " SET label='".$this->db->escape($this->label)."',";
|
||||
$sql.= " datestart='".$this->db->idate($this->datestart)."',";
|
||||
$sql.= " dateend='".$this->db->idate($this->dateend)."',";
|
||||
$sql.= " fk_project='".$this->db->escape($this->fk_project)."',";
|
||||
$sql.= " fk_projet=".(empty($this->fk_projet)?'NULL':$this->fk_projet).",";
|
||||
$sql.= " fk_user_modif = ".$user->id;
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
|
||||
@ -47,6 +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';
|
||||
|
||||
$langs->load("projects");
|
||||
$langs->load("companies");
|
||||
@ -58,6 +59,7 @@ if (! empty($conf->ficheinter->enabled)) $langs->load("interventions");
|
||||
if (! empty($conf->deplacement->enabled)) $langs->load("trips");
|
||||
if (! empty($conf->expensereport->enabled)) $langs->load("trips");
|
||||
if (! empty($conf->don->enabled)) $langs->load("donations");
|
||||
if (! empty($conf->loan->enabled)) $langs->load("loan");
|
||||
|
||||
$id=GETPOST('id','int');
|
||||
$ref=GETPOST('ref','alpha');
|
||||
@ -370,6 +372,19 @@ $listofreferent=array(
|
||||
'buttonnew'=>'AddDonation',
|
||||
'testnew'=>$user->rights->don->creer,
|
||||
'test'=>$conf->don->enabled && $user->rights->don->lire),
|
||||
'loan'=>array(
|
||||
'name'=>"Loan",
|
||||
'title'=>"ListLoanAssociatedProject",
|
||||
'class'=>'Loan',
|
||||
'margin'=>'add',
|
||||
'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),
|
||||
'agenda'=>array(
|
||||
'name'=>"Agenda",
|
||||
'title'=>"ListActionsAssociatedProject",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user