commit
e503aeb2e5
@ -78,8 +78,9 @@ class Asset extends CommonObject
|
||||
'ref' => array('type'=>'varchar(10)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object",),
|
||||
'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>-1, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,),
|
||||
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text",),
|
||||
'amount' => array('type'=>'double(24,8)', 'label'=>'Amount', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'isameasure'=>'1', 'help'=>"Help text",),
|
||||
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty",),
|
||||
'amount_ht' => array('type'=>'double(24,8)', 'label'=>'AmountHTShort', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'isameasure'=>'1', 'help'=>"Help text",),
|
||||
'amount_vat' => array('type'=>'double(24,8)', 'label'=>'AmountVAT', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'isameasure'=>'1', 'help'=>"Help text",),
|
||||
'fk_asset_type' => array('type'=>'integer:AssetType:asset/class/asset.class.php', 'label'=>'AssetsType', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty",),
|
||||
'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>90, 'notnull'=>-1,),
|
||||
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'visible'=>-1, 'enabled'=>1, 'position'=>91, 'notnull'=>-1,),
|
||||
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'visible'=>-1, 'enabled'=>1, 'position'=>92, 'notnull'=>-1,),
|
||||
|
||||
@ -73,14 +73,23 @@ class AssetType extends CommonObject
|
||||
$error=0;
|
||||
|
||||
$this->label=trim($this->label);
|
||||
$this->accountancy_code_asset = trim($this->accountancy_code_asset);
|
||||
$this->accountancy_code_depreciation_asset = trim($this->accountancy_code_depreciation_asset);
|
||||
$this->accountancy_code_depreciation_expense = trim($this->accountancy_code_depreciation_expense);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."asset_type (";
|
||||
$sql.= "label";
|
||||
$sql.= ", accountancy_code_asset";
|
||||
$sql.= ", accountancy_code_depreciation_asset";
|
||||
$sql.= ", accountancy_code_depreciation_expense";
|
||||
$sql.= ", entity";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= "'".$this->db->escape($this->label)."'";
|
||||
$sql.= ", '".$this->db->escape($this->accountancy_code_asset)."'";
|
||||
$sql.= ", '".$this->db->escape($this->accountancy_code_depreciation_asset)."'";
|
||||
$sql.= ", '".$this->db->escape($this->accountancy_code_depreciation_expense)."'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
|
||||
@ -411,4 +420,14 @@ class AssetType extends CommonObject
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* getLibStatut
|
||||
*
|
||||
* @return string Return status of a type of asset
|
||||
*/
|
||||
function getLibStatut()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -26,6 +26,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/asset.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/asset/class/asset.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/asset/class/asset_type.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.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';
|
||||
|
||||
$langs->load("assets");
|
||||
|
||||
@ -232,8 +235,9 @@ if (! $rowid && $action != 'create' && $action != 'edit')
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("Ref").'</th>';
|
||||
print '<th>'.$langs->trans("Label").'</th>';
|
||||
print '<th align="center">'.$langs->trans("SubscriptionRequired").'</th>';
|
||||
print '<th align="center">'.$langs->trans("VoteAllowed").'</th>';
|
||||
print '<th align="center">'.$langs->trans("AccountancyCodeAsset").'</th>';
|
||||
print '<th align="center">'.$langs->trans("AccountancyCodeDepreciationAsset").'</th>';
|
||||
print '<th align="center">'.$langs->trans("AccountancyCodeDepreciationExpense").'</th>';
|
||||
print '<th> </th>';
|
||||
print "</tr>\n";
|
||||
|
||||
@ -253,9 +257,44 @@ if (! $rowid && $action != 'create' && $action != 'edit')
|
||||
//<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a>
|
||||
print '</td>';
|
||||
print '<td>'.dol_escape_htmltag($objp->label).'</td>';
|
||||
print '<td align="center">'.yn($objp->subscription).'</td>';
|
||||
print '<td align="center">'.yn($objp->vote).'</td>';
|
||||
if ($user->rights->asset->configurer)
|
||||
|
||||
print '<td>';
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch('',$object->accountancy_code_asset,1);
|
||||
|
||||
print $accountingaccount->getNomUrl(0,1,1,'',1);
|
||||
} else {
|
||||
print $object->accountancy_code_asset;
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
$accountingaccount2 = new AccountingAccount($db);
|
||||
$accountingaccount2->fetch('',$object->accountancy_code_depreciation_asset,1);
|
||||
|
||||
print $accountingaccount2->getNomUrl(0,1,1,'',1);
|
||||
} else {
|
||||
print $object->accountancy_code_depreciation_asset;
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
$accountingaccount3 = new AccountingAccount($db);
|
||||
$accountingaccount3->fetch('',$object->accountancy_code_depreciation_expense,1);
|
||||
|
||||
print $accountingaccount3->getNomUrl(0,1,1,'',1);
|
||||
} else {
|
||||
print $object->accountancy_code_depreciation_expense;
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
if ($user->rights->asset->write)
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
|
||||
else
|
||||
print '<td align="right"> </td>';
|
||||
@ -282,8 +321,9 @@ if (! $rowid && $action != 'create' && $action != 'edit')
|
||||
if ($action == 'create')
|
||||
{
|
||||
$object = new AssetType($db);
|
||||
if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
|
||||
|
||||
print load_fiche_titre($langs->trans("NewMemberType"));
|
||||
print load_fiche_titre($langs->trans("NewAssetType"));
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -296,23 +336,48 @@ if ($action == 'create')
|
||||
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="label" size="40"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||
print $form->selectyesno("subscription",1,1);
|
||||
print '</td></tr>';
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
// Accountancy_code_asset
|
||||
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeAsset").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($object->accountancy_code_asset, 'accountancy_code_asset', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
||||
print $form->selectyesno("vote",0,1);
|
||||
print '</td></tr>';
|
||||
// Accountancy_code_depreciation_expense
|
||||
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationAsset").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($object->accountancy_code_depreciation_asset, 'accountancy_code_depreciation_asset', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_depreciation_expense
|
||||
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationExpense").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($object->accountancy_code_depreciation_expense, 'accountancy_code_depreciation_expense', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
}
|
||||
else // For external software
|
||||
{
|
||||
// Accountancy_code_asset
|
||||
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeAsset").'</td>';
|
||||
print '<td><input name="accountancy_code_asset" class="maxwidth200" value="'.$object->accountancy_code_asset.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_depreciation_asset
|
||||
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationAsset").'</td>';
|
||||
print '<td><input name="accountancy_code_depreciation_asset" class="maxwidth200" value="'.$object->accountancy_code_depreciation_asset.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_depreciation_expense
|
||||
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationExpense").'</td>';
|
||||
print '<td><input name="accountancy_code_depreciation_expense" class="maxwidth200" value="'.$object->accountancy_code_depreciation_expense.'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
print '<textarea name="comment" wrap="soft" class="centpercent" rows="3"></textarea></td></tr>';
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('mail_valid',$object->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,'90%');
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
// Other attributes
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
|
||||
@ -356,9 +421,9 @@ if ($rowid > 0)
|
||||
print $form->formconfirm($_SERVER['PHP_SELF']."?rowid=".$object->id,$langs->trans("DeleteAMemberType"),$langs->trans("ConfirmDeleteMemberType",$object->label),"confirm_delete", '',0,1);
|
||||
}
|
||||
|
||||
$head = member_type_prepare_head($object);
|
||||
$head = asset_type_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("MemberType"), -1, 'group');
|
||||
dol_fiche_head($head, 'card', $langs->trans("AssetType"), -1, 'setup');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/asset/type.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
@ -369,20 +434,45 @@ if ($rowid > 0)
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||
print yn($object->subscription);
|
||||
print '</tr>';
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch('',$object->accountancy_code_asset,1);
|
||||
|
||||
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
||||
print yn($object->vote);
|
||||
print $accountingaccount->getNomUrl(0,1,1,'',1);
|
||||
} else {
|
||||
print $object->accountancy_code_asset;
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
$accountingaccount2 = new AccountingAccount($db);
|
||||
$accountingaccount2->fetch('',$object->accountancy_code_depreciation_asset,1);
|
||||
|
||||
print $accountingaccount2->getNomUrl(0,1,1,'',1);
|
||||
} else {
|
||||
print $object->accountancy_code_depreciation_asset;
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
$accountingaccount3 = new AccountingAccount($db);
|
||||
$accountingaccount3->fetch('',$object->accountancy_code_depreciation_expense,1);
|
||||
|
||||
print $accountingaccount3->getNomUrl(0,1,1,'',1);
|
||||
} else {
|
||||
print $object->accountancy_code_depreciation_expense;
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
print nl2br($object->note)."</td></tr>";
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
|
||||
print nl2br($object->mail_valid)."</td></tr>";
|
||||
|
||||
// Other attributes
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
@ -398,7 +488,7 @@ if ($rowid > 0)
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
// Edit
|
||||
if ($user->rights->asset->configurer)
|
||||
if ($user->rights->asset->write)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&rowid='.$object->id.'">'.$langs->trans("Modify").'</a></div>';
|
||||
}
|
||||
@ -407,7 +497,7 @@ if ($rowid > 0)
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=create&typeid='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.$langs->trans("AddMember").'</a></div>';
|
||||
|
||||
// Delete
|
||||
if ($user->rights->asset->configurer)
|
||||
if ($user->rights->asset->write)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&rowid='.$object->id.'">'.$langs->trans("DeleteType").'</a></div>';
|
||||
}
|
||||
@ -415,8 +505,7 @@ if ($rowid > 0)
|
||||
print "</div>";
|
||||
|
||||
|
||||
// Show list of members (nearly same code than in page list.php)
|
||||
|
||||
// Show list of assets (nearly same code than in page list.php)
|
||||
$assettypestatic=new AssetType($db);
|
||||
|
||||
$now=dol_now();
|
||||
@ -426,7 +515,7 @@ if ($rowid > 0)
|
||||
$sql.= " a.fk_asset_type as type_id,";
|
||||
$sql.= " t.label as type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."asset as a, ".MAIN_DB_PREFIX."asset_type as t";
|
||||
$sql.= " WHERE a.fk_asset_type = t.rowid ";
|
||||
$sql.= " WHERE a.fk_asset_type = t.rowid";
|
||||
$sql.= " AND a.entity IN (".getEntity('asset').")";
|
||||
$sql.= " AND t.rowid = ".$object->id;
|
||||
if ($sall)
|
||||
@ -441,8 +530,8 @@ if ($rowid > 0)
|
||||
{
|
||||
if (GETPOST('search','alpha'))
|
||||
{
|
||||
$sql.= natural_search(array("d.firstname","d.lastname"), GETPOST('search','alpha'));
|
||||
}
|
||||
$sql.= natural_search(array("d.firstname","d.lastname"), GETPOST('search','alpha'));
|
||||
}
|
||||
}
|
||||
if (! empty($search_lastname))
|
||||
{
|
||||
@ -612,35 +701,6 @@ if ($rowid > 0)
|
||||
print $adh->LibStatut($objp->statut,$objp->subscription,$datefin,2);
|
||||
print "</td>";
|
||||
|
||||
// Date end subscription
|
||||
if ($datefin)
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
if ($datefin < dol_now() && $objp->statut > 0)
|
||||
{
|
||||
print dol_print_date($datefin,'day')." ".img_warning($langs->trans("SubscriptionLate"));
|
||||
}
|
||||
else
|
||||
{
|
||||
print dol_print_date($datefin,'day');
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="left" class="nowrap">';
|
||||
if ($objp->subscription == 'yes')
|
||||
{
|
||||
print $langs->trans("SubscriptionNotReceived");
|
||||
if ($objp->statut > 0) print " ".img_warning();
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Actions
|
||||
print '<td align="center">';
|
||||
if ($user->rights->asset->creer)
|
||||
@ -685,15 +745,16 @@ if ($rowid > 0)
|
||||
$object = new AssetType($db);
|
||||
$object->fetch($rowid);
|
||||
$object->fetch_optionals();
|
||||
if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
|
||||
|
||||
$head = member_type_prepare_head($object);
|
||||
$head = asset_type_prepare_head($object);
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="rowid" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group');
|
||||
dol_fiche_head($head, 'card', $langs->trans("AssetsType"), -1, 'setup');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
@ -701,23 +762,48 @@ if ($rowid > 0)
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="label" size="40" value="'.dol_escape_htmltag($object->label).'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||
print $form->selectyesno("subscription",$object->subscription,1);
|
||||
print '</td></tr>';
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
// Accountancy_code_asset
|
||||
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeAsset").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($object->accountancy_code_asset, 'accountancy_code_asset', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
||||
print $form->selectyesno("vote",$object->vote,1);
|
||||
print '</td></tr>';
|
||||
// Accountancy_code_depreciation_expense
|
||||
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationAsset").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($object->accountancy_code_depreciation_asset, 'accountancy_code_depreciation_asset', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_depreciation_expense
|
||||
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationExpense").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($object->accountancy_code_depreciation_expense, 'accountancy_code_depreciation_expense', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
}
|
||||
else // For external software
|
||||
{
|
||||
// Accountancy_code_asset
|
||||
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeAsset").'</td>';
|
||||
print '<td><input name="accountancy_code_asset" class="maxwidth200" value="'.$object->accountancy_code_asset.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_depreciation_asset
|
||||
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationAsset").'</td>';
|
||||
print '<td><input name="accountancy_code_depreciation_asset" class="maxwidth200" value="'.$object->accountancy_code_depreciation_asset.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_depreciation_expense
|
||||
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationExpense").'</td>';
|
||||
print '<td><input name="accountancy_code_depreciation_expense" class="maxwidth200" value="'.$object->accountancy_code_depreciation_expense.'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
print '<textarea name="comment" wrap="soft" class="centpercent" rows="3">'.$object->note.'</textarea></td></tr>';
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('mail_valid',$object->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,'90%');
|
||||
$doleditor->Create();
|
||||
print "</td></tr>";
|
||||
|
||||
// Other attributes
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
@ -118,3 +118,32 @@ function AssetsPrepareHead()
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return array head with list of tabs to view object informations
|
||||
*
|
||||
* @param AssetType $object Asset
|
||||
* @return array head
|
||||
*/
|
||||
function asset_type_prepare_head(AssetType $object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
|
||||
$h=0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/asset/type.php?rowid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'assettype');
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'assettype','remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
@ -1144,11 +1144,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
{
|
||||
$langs->load("assets");
|
||||
$newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy",$langs->trans("MenuAssets"), 0, $user->rights->asset->read, '', $mainmenu, 'asset');
|
||||
$newmenu->add("/asset/card.php?leftmenu=asset&action=create",$langs->trans("MenuNewAsset"), 1, $user->rights->asset->write);
|
||||
$newmenu->add("/asset/type.php?leftmenu=asset",$langs->trans("MenuTypeAssets"), 1, $user->rights->asset->read, '', $mainmenu, 'asset_type');
|
||||
$newmenu->add("/asset/type.php?leftmenu=asset_type&action=create",$langs->trans("MenuNewTypeAssets"), 1, $user->rights->asset->write);
|
||||
$newmenu->add("/asset/type.php?leftmenu=asset_type",$langs->trans("MenuListTypeAssets"), 1, $user->rights->asset->read);
|
||||
$newmenu->add("/asset/list.php?leftmenu=asset",$langs->trans("MenuListAssets"), 1, $user->rights->asset->read);
|
||||
$newmenu->add("/asset/card.php?action=create",$langs->trans("MenuNewAsset"), 1, $user->rights->asset->write);
|
||||
$newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy",$langs->trans("MenuListAssets"), 1, $user->rights->asset->read);
|
||||
$newmenu->add("/asset/type.php?leftmenu=asset_type",$langs->trans("MenuTypeAssets"), 1, $user->rights->asset->read, '', $mainmenu, 'asset_type');
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/asset_type/',$leftmenu)) $newmenu->add("/asset/type.php?leftmenu=asset_type&action=create",$langs->trans("MenuNewTypeAssets"), 2, $user->rights->asset->write);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/asset_type/',$leftmenu)) $newmenu->add("/asset/type.php?leftmenu=asset_type",$langs->trans("MenuListTypeAssets"), 2, $user->rights->asset->read);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -219,23 +219,65 @@ class modAsset extends DolibarrModules
|
||||
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
|
||||
|
||||
// Exports
|
||||
//--------
|
||||
$r=1;
|
||||
|
||||
// $this->export_code[$r] Code unique identifiant l'export (tous modules confondus)
|
||||
// $this->export_label[$r] Libelle par defaut si traduction de cle "ExportXXX" non trouvee (XXX = Code)
|
||||
// $this->export_permission[$r] Liste des codes permissions requis pour faire l'export
|
||||
// $this->export_fields_sql[$r] Liste des champs exportables en codif sql
|
||||
// $this->export_fields_name[$r] Liste des champs exportables en codif traduction
|
||||
// $this->export_sql[$r] Requete sql qui offre les donnees a l'export
|
||||
|
||||
/*
|
||||
$langs->load("fixedassets@fixedassets");
|
||||
$r++;
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='FixedAssetsLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r]='fixedassets@fixedassets';
|
||||
$keyforclass = 'FixedAssets'; $keyforclassfile='/mymobule/class/fixedassets.class.php'; $keyforelement='fixedassets';
|
||||
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
|
||||
$keyforselect='fixedassets'; $keyforaliasextra='extra'; $keyforelement='fixedassets';
|
||||
$this->export_label[$r]='AssetsLines';
|
||||
$this->export_permission[$r]=array(array("asset","export"));
|
||||
$this->export_fields_array[$r]=array('a.rowid'=>'Id','a.civility'=>"UserTitle",'a.lastname'=>"Lastname",'a.firstname'=>"Firstname",'a.login'=>"Login",'a.morphy'=>'Nature','a.societe'=>'Company','a.address'=>"Address",'a.zip'=>"Zip",'a.town'=>"Town",'d.nom'=>"State",'co.code'=>"CountryCode",'co.label'=>"Country",'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",'a.email'=>"Email",'a.birth'=>"Birthday",'a.statut'=>"Status",'a.photo'=>"Photo",'a.note_public'=>"NotePublic",'a.note_private'=>"NotePrivate",'a.datec'=>'DateCreation','a.datevalid'=>'DateValidation','a.tms'=>'DateLastModification','a.datefin'=>'DateEndSubscription','ta.rowid'=>'AssetTypeId','ta.label'=>'AssetTypeLabel','ta.accountancy_code_asset'=>'AccountancyCodeAsset','ta.accountancy_code_depreciation_asset'=>'AccountancyCodeDepreciationAsset','ta.accountancy_code_depreciation_expense'=>'AccountancyCodeDepreciationExpense');
|
||||
$this->export_TypeFields_array[$r]=array('a.civility'=>"Text",'a.lastname'=>"Text",'a.firstname'=>"Text",'a.login'=>"Text",'a.morphy'=>'Text','a.societe'=>'Text','a.address'=>"Text",'a.zip'=>"Text",'a.town'=>"Text",'d.nom'=>"Text",'co.code'=>'Text','co.label'=>"Text",'a.phone'=>"Text",'a.phone_perso'=>"Text",'a.phone_mobile'=>"Text",'a.email'=>"Text",'a.birth'=>"Date",'a.statut'=>"Status",'a.note_public'=>"Text",'a.note_private'=>"Text",'a.datec'=>'Date','a.datevalid'=>'Date','a.tms'=>'Date','a.datefin'=>'Date','ta.rowid'=>'List:asset_type:label','ta.label'=>'Text','ta.accountancy_code_asset'=>'Text','ta.accountancy_code_depreciation_asset'=>'Text','ta.accountancy_code_depreciation_expense'=>'Text');
|
||||
$this->export_entities_array[$r]=array('a.rowid'=>'member','a.civility'=>"member",'a.lastname'=>"member",'a.firstname'=>"member",'a.login'=>"member",'a.morphy'=>'member','a.societe'=>'member','a.address'=>"member",'a.zip'=>"member",'a.town'=>"member",'d.nom'=>"member",'co.code'=>"member",'co.label'=>"member",'a.phone'=>"member",'a.phone_perso'=>"member",'a.phone_mobile'=>"member",'a.email'=>"member",'a.birth'=>"member",'a.statut'=>"member",'a.photo'=>"member",'a.note_public'=>"member",'a.note_private'=>"member",'a.datec'=>'member','a.datevalid'=>'member','a.tms'=>'member','a.datefin'=>'member','ta.rowid'=>'asset_type','ta.label'=>'asset_type''ta.accountancy_code_asset'=>'asset_type''ta.accountancy_code_depreciation_asset'=>'asset_type''ta.accountancy_code_depreciation_expense'=>'asset_type');
|
||||
// Add extra fields
|
||||
$keyforselect='asset'; $keyforelement='asset'; $keyforaliasextra='extra';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
//$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
|
||||
// End add axtra fields
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'fixedassets as t';
|
||||
$this->export_sql_end[$r] .=' WHERE 1 = 1';
|
||||
$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('fixedassets').')';
|
||||
$r++; */
|
||||
$this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'asset_type as ta, '.MAIN_DB_PREFIX.'asset as a)';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'asset_extrafields as extra ON a.rowid = extra.fk_object';
|
||||
$this->export_sql_end[$r] .=' WHERE a.fk_asset_type = ta.rowid AND ta.entity IN ('.getEntity('asset_type').') ';
|
||||
|
||||
// Imports
|
||||
//--------
|
||||
$r=0;
|
||||
|
||||
$now=dol_now();
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
$r++;
|
||||
$this->import_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->import_label[$r]="Assets"; // Translation key
|
||||
$this->import_icon[$r]=$this->picto;
|
||||
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->import_tables_array[$r]=array('a'=>MAIN_DB_PREFIX.'asset','extra'=>MAIN_DB_PREFIX.'asset_extrafields');
|
||||
$this->import_tables_creator_array[$r]=array('a'=>'fk_user_author'); // Fields to store import user id
|
||||
$this->import_fields_array[$r]=array('a.civility'=>"UserTitle",'a.lastname'=>"Lastname*",'a.firstname'=>"Firstname",'a.login'=>"Login*","a.pass"=>"Password","a.fk_adherent_type"=>"MemberType*",'a.morphy'=>'Nature*','a.societe'=>'Company','a.address'=>"Address",'a.zip'=>"Zip",'a.town'=>"Town",'a.state_id'=>'StateId','a.country'=>"CountryId",'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",'a.email'=>"Email",'a.birth'=>"Birthday",'a.statut'=>"Status*",'a.photo'=>"Photo",'a.note_public'=>"NotePublic",'a.note_private'=>"NotePrivate",'a.datec'=>'DateCreation','a.datefin'=>'DateEndSubscription');
|
||||
// Add extra fields
|
||||
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'asset' AND entity = ".$conf->entity;
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
{
|
||||
while ($obj=$this->db->fetch_object($resql))
|
||||
{
|
||||
$fieldname='extra.'.$obj->name;
|
||||
$fieldlabel=ucfirst($obj->label);
|
||||
$this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':'');
|
||||
}
|
||||
}
|
||||
// End add extra fields
|
||||
$this->import_fieldshidden_array[$r]=array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'asset'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
|
||||
$this->import_regex_array[$r]=array('a.civility'=>'code@'.MAIN_DB_PREFIX.'c_civility','a.fk_adherent_type'=>'rowid@'.MAIN_DB_PREFIX.'adherent_type','a.morphy'=>'(phy|mor)','a.statut'=>'^[0|1]','a.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','a.datefin'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
|
||||
$this->import_examplevalues_array[$r]=array('a.civility'=>"MR",'a.lastname'=>'Smith','a.firstname'=>'John','a.login'=>'jsmith','a.pass'=>'passofjsmith','a.fk_adherent_type'=>'1','a.morphy'=>'"mor" or "phy"','a.societe'=>'JS company','a.address'=>'21 jump street','a.zip'=>'55000','a.town'=>'New York','a.country'=>'1','a.email'=>'jsmith@example.com','a.birth'=>'1972-10-10','a.statut'=>"0 or 1",'a.note_public'=>"This is a public comment on member",'a.note_private'=>"This is private comment on member",'a.datec'=>dol_print_date($now,'%Y-%m__%d'),'a.datefin'=>dol_print_date(dol_time_plus_duree($now, 1, 'y'),'%Y-%m-%d'));
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -389,9 +389,9 @@ CREATE TABLE llx_asset(
|
||||
ref varchar(128) NOT NULL,
|
||||
entity integer DEFAULT 1 NOT NULL,
|
||||
label varchar(255),
|
||||
amount double(24,8) DEFAULT NULL,
|
||||
amount_ht double(24,8) DEFAULT NULL,
|
||||
amount_vat double(24,8) DEFAULT NULL,
|
||||
fk_asset_type integer NOT NULL,
|
||||
fk_soc integer,
|
||||
description text,
|
||||
note_public text,
|
||||
note_private text,
|
||||
@ -406,7 +406,6 @@ CREATE TABLE llx_asset(
|
||||
ALTER TABLE llx_asset ADD INDEX idx_asset_rowid (rowid);
|
||||
ALTER TABLE llx_asset ADD INDEX idx_asset_ref (ref);
|
||||
ALTER TABLE llx_asset ADD INDEX idx_asset_entity (entity);
|
||||
ALTER TABLE llx_asset ADD INDEX idx_asset_fk_soc (fk_soc);
|
||||
|
||||
ALTER TABLE llx_asset ADD INDEX idx_asset_fk_asset_type (fk_asset_type);
|
||||
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
ALTER TABLE llx_asset ADD INDEX idx_asset_rowid (rowid);
|
||||
ALTER TABLE llx_asset ADD INDEX idx_asset_ref (ref);
|
||||
ALTER TABLE llx_asset ADD INDEX idx_asset_entity (entity);
|
||||
ALTER TABLE llx_asset ADD INDEX idx_asset_fk_soc (fk_soc);
|
||||
|
||||
ALTER TABLE llx_asset ADD INDEX idx_asset_fk_asset_type (fk_asset_type);
|
||||
ALTER TABLE llx_asset ADD CONSTRAINT fk_asset_asset_type FOREIGN KEY (fk_asset_type) REFERENCES llx_asset_type (rowid);
|
||||
|
||||
@ -19,9 +19,9 @@ CREATE TABLE llx_asset(
|
||||
ref varchar(128) NOT NULL,
|
||||
entity integer DEFAULT 1 NOT NULL,
|
||||
label varchar(255),
|
||||
amount double(24,8) DEFAULT NULL,
|
||||
amount_ht double(24,8) DEFAULT NULL,
|
||||
amount_vat double(24,8) DEFAULT NULL,
|
||||
fk_asset_type integer NOT NULL,
|
||||
fk_soc integer,
|
||||
description text,
|
||||
note_public text,
|
||||
note_private text,
|
||||
|
||||
@ -18,9 +18,11 @@
|
||||
#
|
||||
Assets = Assets
|
||||
NewAsset = New asset
|
||||
AccountancyAccountAsset = Accounting code (asset)
|
||||
AccountancyAccountDepreciationAsset = Accounting code (depreciation asset account)
|
||||
AccountancyAccountDepreciationExpense = Accounting code (depreciation expense account)
|
||||
AccountancyCodeAsset = Accounting code (asset)
|
||||
AccountancyCodeDepreciationAsset = Accounting code (depreciation asset account)
|
||||
AccountancyCodeDepreciationExpense = Accounting code (depreciation expense account)
|
||||
NewAssetType=New asset type
|
||||
AssetsLines=Assets
|
||||
|
||||
# Module label 'ModuleAssetsName'
|
||||
ModuleAssetsName = Assets
|
||||
@ -44,5 +46,7 @@ AssetsTypes=Assets types
|
||||
#
|
||||
MenuAssets = Assets
|
||||
MenuNewAsset = New asset
|
||||
MenuTypeAssets = Type
|
||||
MenuTypeAssets = Type assets
|
||||
MenuListAssets = List
|
||||
MenuNewTypeAssets = New type
|
||||
MenuListTypeAssets = List
|
||||
|
||||
Loading…
Reference in New Issue
Block a user